nomad

package
v0.0.0-...-174afc0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 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.PersistentVolume, error)

Transform the evaluation of a job to a PersistentVolume

func JobToPv

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

Transform a Nomad Job to a PersistentVolume

func MakeJob

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

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 PvcToJob

func PvcToJob(pvc *v1.PersistentVolumeClaim) (*api.Job, error)

Transform a PersistentVolumeClaim type to Nomad job type

func PvcToJobName

func PvcToJobName(pvc *v1.PersistentVolumeClaim) (string, error)

Get the job name from a persistent volume claim

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

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

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

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