controller

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: Apache-2.0 Imports: 34 Imported by: 17

Documentation

Index

Constants

View Source
const (
	//AnnCloneRequest sets our expected annotation for a CloneRequest
	AnnCloneRequest = "k8s.io/CloneRequest"
	//AnnCloneOf is used to indicate that cloning was complete
	AnnCloneOf = "k8s.io/CloneOf"
	//CloneUniqueID is used as a special label to be used when we search for the pod
	CloneUniqueID = "cdi.kubevirt.io/storage.clone.cloneUniqeId"
	//AnnTargetPodNamespace is being used as a pod label to find the related target PVC
	AnnTargetPodNamespace = "cdi.kubevirt.io/storage.clone.targetPod.namespace"
)
View Source
const (
	//AnnCreatedBy is a pod annotation indicating if the pod was created by the PVC
	AnnCreatedBy = "cdi.kubevirt.io/storage.createdByController"
	//AnnPodPhase is a PVC annotation indicating the related pod progress (phase)
	AnnPodPhase = "cdi.kubevirt.io/storage.pod.phase"
)
View Source
const (
	// SuccessSynced provides a const to represent a Synced status
	SuccessSynced = "Synced"
	// ErrResourceExists provides a const to indicate a resource exists error
	ErrResourceExists = "ErrResourceExists"
	// ErrResourceDoesntExist provides a const to indicate a resource doesn't exist error
	ErrResourceDoesntExist = "ErrResourceDoesntExist"
	// ErrClaimLost provides a const to indicate a claim is lost
	ErrClaimLost = "ErrClaimLost"
	// DataVolumeFailed provides a const to represent DataVolume failed status
	DataVolumeFailed = "DataVolumeFailed"
	// ImportScheduled provides a const to indicate import is scheduled
	ImportScheduled = "ImportScheduled"
	// ImportInProgress provides a const to indicate an import is in progress
	ImportInProgress = "ImportInProgress"
	// ImportFailed provides a const to indicate import has failed
	ImportFailed = "ImportFailed"
	// ImportSucceeded provides a const to indicate import has succeeded
	ImportSucceeded = "ImportSucceeded"
	// CloneScheduled provides a const to indicate clone is scheduled
	CloneScheduled = "CloneScheduled"
	// CloneInProgress provides a const to indicate clone is in progress
	CloneInProgress = "CloneInProgress"
	// CloneFailed provides a const to indicate clone has failed
	CloneFailed = "CloneFailed"
	// CloneSucceeded provides a const to indicate clone has succeeded
	CloneSucceeded = "CloneSucceeded"
	// UploadScheduled provides a const to indicate upload is scheduled
	UploadScheduled = "UploadScheduled"
	// UploadReady provides a const to indicate upload is in progress
	UploadReady = "UploadReady"
	// UploadFailed provides a const to indicate upload has failed
	UploadFailed = "UploadFailed"
	// UploadSucceeded provides a const to indicate upload has succeeded
	UploadSucceeded = "UploadSucceeded"
	// MessageResourceExists provides a const to form a resource exists error message
	MessageResourceExists = "Resource %q already exists and is not managed by DataVolume"
	// MessageResourceDoesntExist provides a const to form a resource doesn't exist error message
	MessageResourceDoesntExist = "Resource managed by %q doesn't exist"
	// MessageResourceSynced provides a const to standardize a Resource Synced message
	MessageResourceSynced = "DataVolume synced successfully"
	// MessageErrClaimLost provides a const to form claim lost message
	MessageErrClaimLost = "PVC %s lost"
	// MessageImportScheduled provides a const to form import is scheduled message
	MessageImportScheduled = "Import into %s scheduled"
	// MessageImportInProgress provides a const to form import is in progress message
	MessageImportInProgress = "Import into %s in progress"
	// MessageImportFailed provides a const to form import has failed message
	MessageImportFailed = "Failed to import into PVC %s"
	// MessageImportSucceeded provides a const to form import has succeeded message
	MessageImportSucceeded = "Successfully imported into PVC %s"
	// MessageCloneScheduled provides a const to form clone is scheduled message
	MessageCloneScheduled = "Cloning from %s/%s into %s/%s scheduled"
	// MessageCloneInProgress provides a const to form clone is in progress message
	MessageCloneInProgress = "Cloning from %s/%s into %s/%s in progress"
	// MessageCloneFailed provides a const to form clone has failed message
	MessageCloneFailed = "Cloning from %s/%s into %s/%s failed"
	// MessageCloneSucceeded provides a const to form clone has succeeded message
	MessageCloneSucceeded = "Successfully cloned from %s/%s into %s/%s"
	// MessageUploadScheduled provides a const to form upload is scheduled message
	MessageUploadScheduled = "Upload into %s scheduled"
	// MessageUploadReady provides a const to form upload is ready message
	MessageUploadReady = "Upload into %s ready"
	// MessageUploadFailed provides a const to form upload has failed message
	MessageUploadFailed = "Upload into %s failed"
	// MessageUploadSucceeded provides a const to form upload has succeeded message
	MessageUploadSucceeded = "Successfully uploaded into %s"
)
View Source
const (
	// AnnAPIGroup is the APIGroup for CDI
	AnnAPIGroup = "cdi.kubevirt.io"
	// AnnSource provide a const for our PVC import source annotation
	AnnSource = AnnAPIGroup + "/storage.import.source"
	// AnnEndpoint provides a const for our PVC endpoint annotation
	AnnEndpoint = AnnAPIGroup + "/storage.import.endpoint"
	// AnnSecret provides a const for our PVC secretName annotation
	AnnSecret = AnnAPIGroup + "/storage.import.secretName"
	// AnnContentType provides a const for the PVC content-type
	AnnContentType = AnnAPIGroup + "/storage.contentType"
	// AnnImportPod provides a const for our PVC importPodName annotation
	AnnImportPod = AnnAPIGroup + "/storage.import.importPodName"
	//LabelImportPvc is a pod label used to find the import pod that was created by the relevant PVC
	LabelImportPvc = AnnAPIGroup + "/storage.import.importPvcName"
)
View Source
const (
	// DataVolName provides a const to use for creating volumes in pod specs
	DataVolName = "cdi-data-vol"

	// ImagePathName provides a const to use for creating volumes in pod specs
	ImagePathName = "image-path"

	// SourceHTTP is the source type HTTP, if unspecified or invalid, it defaults to SourceHTTP
	SourceHTTP = "http"
	// SourceS3 is the source type S3
	SourceS3 = "s3"
	// SourceGlance is the source type of glance
	SourceGlance = "glance"
	// SourceNone means there is no source.
	SourceNone = "none"
	// SourceRegistry is the source type of Registry
	SourceRegistry = "registry"
)
View Source
const (
	// AnnUploadRequest marks that a PVC should be made available for upload
	AnnUploadRequest = "cdi.kubevirt.io/storage.upload.target"
)

Variables

This section is empty.

Functions

func CreateCloneSourcePod

func CreateCloneSourcePod(client kubernetes.Interface, image string, pullPolicy string, cr string, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)

CreateCloneSourcePod creates our cloning src pod which will be used for out of band cloning to read the contents of the src PVC

func CreateCloneTargetPod

func CreateCloneTargetPod(client kubernetes.Interface, image string, pullPolicy string,
	pvc *v1.PersistentVolumeClaim, podAffinityNamespace string) (*v1.Pod, error)

CreateCloneTargetPod creates our cloning tgt pod which will be used for out of band cloning to write the contents of the tgt PVC

func CreateImporterPod

func CreateImporterPod(client kubernetes.Interface, image, verbose, pullPolicy string, podEnvVar *importPodEnvVar, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)

CreateImporterPod creates and returns a pointer to a pod which is created based on the passed-in endpoint, secret name, and pvc. A nil secret means the endpoint credentials are not passed to the importer pod.

func CreateUploadPod

func CreateUploadPod(client kubernetes.Interface,
	caKeyPair *triple.KeyPair,
	clientCACert *x509.Certificate,
	image string,
	verbose string,
	pullPolicy string,
	name string,
	pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)

CreateUploadPod creates upload service pod manifest and sends to server

func CreateUploadService

func CreateUploadService(client kubernetes.Interface, name string, pvc *v1.PersistentVolumeClaim) (*v1.Service, error)

CreateUploadService creates upload service service manifest and sends to server

func GetUploadResourceName

func GetUploadResourceName(pvcName string) string

GetUploadResourceName returns the name given to upload services/pods

func MakeCloneSourcePodSpec

func MakeCloneSourcePodSpec(image, pullPolicy, sourcePvcName string, pvc *v1.PersistentVolumeClaim) *v1.Pod

MakeCloneSourcePodSpec creates and returns the clone source pod spec based on the target pvc.

func MakeCloneTargetPodSpec

func MakeCloneTargetPodSpec(image, pullPolicy, podAffinityNamespace string, pvc *v1.PersistentVolumeClaim) *v1.Pod

MakeCloneTargetPodSpec creates and returns the clone target pod spec based on the target pvc.

func MakeImporterPodSpec

func MakeImporterPodSpec(image, verbose, pullPolicy string, podEnvVar *importPodEnvVar, pvc *v1.PersistentVolumeClaim) *v1.Pod

MakeImporterPodSpec creates and return the importer pod spec based on the passed-in endpoint, secret and pvc.

func MakePVCOwnerReference added in v1.5.1

func MakePVCOwnerReference(pvc *v1.PersistentVolumeClaim) metav1.OwnerReference

MakePVCOwnerReference makes owner reference from a PVC

func MakePodOwnerReference added in v1.5.1

func MakePodOwnerReference(pod *v1.Pod) metav1.OwnerReference

MakePodOwnerReference makes owner reference from a Pod

func MakeUploadPodSpec

func MakeUploadPodSpec(image, verbose, pullPolicy, name string, pvc *v1.PersistentVolumeClaim, secretName string) *v1.Pod

MakeUploadPodSpec creates upload service pod manifest

func MakeUploadServiceSpec

func MakeUploadServiceSpec(name string, pvc *v1.PersistentVolumeClaim) *v1.Service

MakeUploadServiceSpec creates upload service service manifest

func ParseSourcePvcAnnotation

func ParseSourcePvcAnnotation(sourcePvcAnno, del string) (namespace, name string)

ParseSourcePvcAnnotation parses out the annotations for a CDI PVC

func UploadPossibleForPVC

func UploadPossibleForPVC(pvc *v1.PersistentVolumeClaim) error

UploadPossibleForPVC is called by the api server to see whether to return an upload token

Types

type CloneController

type CloneController struct {
	Controller
}

CloneController represents the CDI Clone Controller

func NewCloneController

func NewCloneController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	image string,
	pullPolicy string,
	verbose string) *CloneController

NewCloneController sets up a Clone Controller, and returns a pointer to to the newly created Controller

func (*CloneController) ProcessNextPvcItem

func (cc *CloneController) ProcessNextPvcItem() bool

ProcessNextPvcItem ...

func (*CloneController) Run

func (cc *CloneController) Run(threadiness int, stopCh <-chan struct{}) error

Run is being called from cdi-controller (cmd)

type Controller

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

Controller is a struct that contains common information and functionality used by all CDI controllers.

func NewController

func NewController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	image string,
	pullPolicy string,
	verbose string) *Controller

NewController is called when we instantiate any CDI controller.

type DataVolumeController

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

DataVolumeController represents the CDI Data Volume Controller

func NewDataVolumeController

func NewDataVolumeController(
	kubeclientset kubernetes.Interface,
	cdiClientSet clientset.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	dataVolumeInformer informers.DataVolumeInformer) *DataVolumeController

NewDataVolumeController sets up a Data Volume Controller, and return a pointer to the newly created Controller

func (*DataVolumeController) Run

func (c *DataVolumeController) Run(threadiness int, stopCh <-chan struct{}) error

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.

type DataVolumeEvent added in v1.3.0

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

DataVolumeEvent reoresents event

type ImportController

type ImportController struct {
	Controller
}

ImportController represents a CDI Import Controller

func NewImportController

func NewImportController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	image string,
	pullPolicy string,
	verbose string) *ImportController

NewImportController sets up an Import Controller, and returns a pointer to the newly created Import Controller

func (*ImportController) ProcessNextPvcItem

func (ic *ImportController) ProcessNextPvcItem() bool

ProcessNextPvcItem ...

func (*ImportController) Run

func (ic *ImportController) Run(threadiness int, stopCh <-chan struct{}) error

Run is being called from cdi-controller (cmd)

type UploadController

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

UploadController members

func NewUploadController

func NewUploadController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	serviceInformer coreinformers.ServiceInformer,
	uploadServiceImage string,
	uploadProxyServiceName string,
	pullPolicy string,
	verbose string) *UploadController

NewUploadController returns a new UploadController

func (*UploadController) Run

func (c *UploadController) Run(threadiness int, stopCh <-chan struct{}) error

Run sets up UploadController state and executes main event loop

Jump to

Keyboard shortcuts

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