nomad

package
v0.0.0-...-ec68995 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

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 file plugs the following:

  1. Generic orchprovider &
  2. Nomad orchprovider

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JobEvalToPv

func JobEvalToPv(jobName string, eval *api.Evaluation) (*v1.Volume, error)

JobEvalToPv Transform the evaluation of a job to a PersistentVolume

func JobToPv

func JobToPv(job *api.Job) (*v1.Volume, error)

JobToPv Transform a Nomad Job to a PersistentVolume

func MakeJob

func MakeJob(name string) (*api.Job, error)

MakeJob Allocate a job

func NewNomadOrchestrator

func NewNomadOrchestrator(label v1.NameLabel, name v1.OrchProviderRegistry) (orchprovider.OrchestratorInterface, error)

NewNomadOrchestrator provides a new instance of NomadOrchestrator. This is invoked during binary startup. func NewNomadOrchestrator(name v1.OrchProviderRegistry, region string, config io.Reader) (orchprovider.OrchestratorInterface, error) {

func VolToJob

func VolToJob(vol *v1.Volume) (*api.Job, error)

VolToJob Transform a PersistentVolumeClaim type to Nomad job type

func VolToJobName

func VolToJobName(vol *v1.Volume) (string, error)

VolToJobName Get the job name from volume

Types

type NomadApiInterface

type NomadApiInterface interface {

	// Name of the Nomad API implementor
	Name() string

	// This returns a concrete implementation of StorageApis
	StorageApis() (StorageApis, bool)
}

NomadApiInterface provides a means to issue APIs against a Nomad cluster. These APIs are futher categorized into Networking & Storage specific APIs.

type NomadClients

type NomadClients interface {
	// Http returns the http client that is capable to communicate
	// with Nomad
	Http(profileMap map[string]string) (*api.Client, error)
}

NomadClients 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 NomadOrchestrator

type NomadOrchestrator struct {
	// contains filtered or unexported fields
}

NomadOrchestrator is a concrete representation of following interfaces:

  1. orchprovider.OrchestratorInterface, &
  2. orchprovider.StoragePlacements

func (*NomadOrchestrator) AddStorage

func (n *NomadOrchestrator) AddStorage(volProProfile volProfile.VolumeProvisionerProfile) (*v1.Volume, error)

AddStorage will add persistent volume running as containers. In OpenEBS terms AddStorage will add a VSM.

func (*NomadOrchestrator) DeleteStorage

func (n *NomadOrchestrator) DeleteStorage(volProProfile volProfile.VolumeProvisionerProfile) (bool, error)

DeleteStorage will remove the VSM.

func (*NomadOrchestrator) Label

func (n *NomadOrchestrator) Label() string

Label provides the label assigned against this orchestrator. This is used along with Name() method. This is an implementation of the orchprovider.OrchestratorInterface interface.

func (*NomadOrchestrator) ListStorage

func (n *NomadOrchestrator) ListStorage(volProProfile volProfile.VolumeProvisionerProfile) (*v1.VolumeList, error)

ListStorage will list a collections of VSMs

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) ReadStorage

func (n *NomadOrchestrator) ReadStorage(volProProfile volProfile.VolumeProvisionerProfile) (*v1.Volume, error)

ReadStorage will fetch information about the persistent volume

func (*NomadOrchestrator) Region

func (n *NomadOrchestrator) Region() string

Region provides the region where this orchestrator is running. This is an implementation of the orchprovider.OrchestratorInterface interface.

func (*NomadOrchestrator) StorageOps

func (n *NomadOrchestrator) StorageOps() (orchprovider.StorageOps, bool)

StorageOps deals with storage related operations e.g. scheduling, placements, removal, etc. of persistent volume containers. The low level workings are delegated to the orchestration provider.

NOTE:

This is orchestration provider's implementation of

orchprovider.OrchestratorInterface interface.

type NomadUtilInterface

type NomadUtilInterface interface {

	// Name of nomad utility
	Name() string

	// This is a builder for NomadClients interface. Will return
	// false if not supported.
	NomadClients() (NomadClients, bool)
}

NomadUtilInterface is an abstraction over Hashicorp's Nomad properties & communication utilities.

type StorageApis

type StorageApis interface {
	// Create makes a request to Nomad to create a storage resource
	CreateStorage(job *api.Job, profileMap map[string]string) (*api.Evaluation, error)

	// Delete makes a request to Nomad to delete the storage resource
	DeleteStorage(job *api.Job, profileMap map[string]string) (*api.Evaluation, error)

	// Info provides the storage information w.r.t the provided job name
	StorageInfo(jobName string, profileMap map[string]string) (*api.Job, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL