Documentation ¶
Overview ¶
This file transforms a Nomad scheduler as an orchestration platform for persistent volume placement. OpenEBS calls this as placement of storage pod.
Package nomad provides Nomad implementation of orchestration provider that aligns by the interfaces suggested by mayaserver's orchprovider.
This package primarily consists of below files: 1. nomad.go 2. api.go 3. client.go
The dependencies can be depicted as shown below:
nomad == aligns with ==> orchprovider nomad == depends on ==> api nomad == depends on ==> client api == depends on ==> client
This file acts a bi-directional plug to below resources:
- Mayaserver's orchprovider types
- Hashicorp Nomad's types
Index ¶
- Constants
- func JobSummaryToPv(jobSummary *api.JobSummary) (*v1.PersistentVolume, error)
- func PvToJob(pv *v1.PersistentVolume) (*api.Job, error)
- func PvcToJob(pvc *v1.PersistentVolumeClaim) (*api.Job, error)
- type Apis
- type NomadClient
- type NomadConfig
- type NomadOrchestrator
- func (n *NomadOrchestrator) Name() string
- func (n *NomadOrchestrator) StoragePlacementReq(pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error)
- func (n *NomadOrchestrator) StoragePlacements() (orchprovider.StoragePlacements, bool)
- func (n *NomadOrchestrator) StorageRemovalReq(pv *v1.PersistentVolume) error
- type StorageApis
Constants ¶
const ( // Names of environment variables used to supply the coordinates // of a Nomad deployment EnvNomadAddress = "NOMAD_ADDR" EnvNomadRegion = "NOMAD_REGION" )
const NomadOrchProviderName = "nomad"
Name of this orchestration provider.
Variables ¶
This section is empty.
Functions ¶
func JobSummaryToPv ¶
func JobSummaryToPv(jobSummary *api.JobSummary) (*v1.PersistentVolume, error)
Types ¶
type Apis ¶
type Apis interface { // This returns a client that can communicate with Nomad Client() (NomadClient, error) // This returns a concrete implementation of StorageApis StorageApis(nApiClient NomadClient) (StorageApis, error) }
Apis provides a means to communicate with Nomad Apis
type NomadClient ¶
NomadClient is an abstraction over various connection modes (http, rpc) to Nomad. Http client is currently supported.
NOTE:
This abstraction makes use of Nomad's api package. Nomad's api
package provides:
1. http client abstraction & 2. structures that can send http requests to Nomad's APIs.
type NomadConfig ¶
type NomadConfig struct {
Address string
}
NomadConfig provides the settings that has the coordinates of a Nomad server or a Nomad cluster deployment.
type NomadOrchestrator ¶
type NomadOrchestrator struct {
// contains filtered or unexported fields
}
NomadOrchestrator is a concrete representation of following interfaces:
- orchprovider.OrchestratorInterface &
- orchprovider.StoragePlacements
func (*NomadOrchestrator) Name ¶
func (n *NomadOrchestrator) Name() string
Name provides the name of this orchestrator. This is an implementation of the orchprovider.OrchestratorInterface interface.
func (*NomadOrchestrator) StoragePlacementReq ¶
func (n *NomadOrchestrator) StoragePlacementReq(pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error)
StoragePlacementReq is a contract method implementation of orchprovider.StoragePlacements interface. In this implementation, a resource will be created at a Nomad deployment.
NOTE:
Nomad does not have persistent volume as its first class citizen.
Hence, this resource should exhibit storage characteristics. The validations for this should have been done at the volume plugin implementation.
func (*NomadOrchestrator) StoragePlacements ¶
func (n *NomadOrchestrator) StoragePlacements() (orchprovider.StoragePlacements, bool)
StoragePlacements is this orchestration provider's implementation of the orchprovider.OrchestratorInterface interface.
func (*NomadOrchestrator) StorageRemovalReq ¶
func (n *NomadOrchestrator) StorageRemovalReq(pv *v1.PersistentVolume) error
StorageRemovalReq is a contract method implementation of orchprovider.StoragePlacements interface. In this implementation, the resource will be removed from the Nomad deployment.
NOTE:
Nomad does not have persistent volume as its first class citizen.
Hence, this resource should exhibit storage characteristics. The validations for this should have been done at the volume plugin implementation.
type StorageApis ¶
type StorageApis interface { // Create makes a request to Nomad to create a storage resource CreateStorage(job *api.Job) (*api.JobSummary, error) // Delete makes a request to Nomad to delete the storage resource DeleteStorage(job *api.Job) (string, error) }
StorageApis provides a means to communicate with Nomad Apis w.r.t storage.
NOTE:
A Nomad job spec is treated as a persistent volume storage
spec & then submitted to a Nomad deployment.
NOTE:
Nomad has no notion of Persistent Volume.