controller

package
v1.2.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 27 Imported by: 17

Documentation

Index

Constants

View Source
const (
	//AnnCloneRequest sets our expected annotation for a CloneRequest
	AnnCloneRequest = "k8s.io/CloneRequest"
	// AnnCloneOf sets our expected annotation to inidcate where a clone originated from
	AnnCloneOf = "k8s.io/CloneOf"
	// AnnCloningCreatedBy provides an annotation to indicate the object was created by the CDI controller
	AnnCloningCreatedBy = "cdi.kubevirt.io/storage.cloningCreatedByController"
	// AnnClonePodPhase provides an annotation to indicate the pod phase of the our CDI related pod
	AnnClonePodPhase = "cdi.kubevirt.io/storage.clone.pod.phase"
	// CloneUniqueID provides an annotation to uniquely identify the Clone object
	CloneUniqueID = "cdi.kubevirt.io/storage.clone.cloneUniqeId"
	// AnnTargetPodNamespace provides an annotation to indicate the namespace of the Target Pod in the CDI process
	AnnTargetPodNamespace = "cdi.kubevirt.io/storage.clone.targetPod.namespace"
)
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"
	// MessageResourceExists provides a const to form a resource exists error message
	MessageResourceExists = "Resource %q already exists and is not managed by DataVolume"
	// MessageResourceSynced provides a const to standardize a Resource Synced message
	MessageResourceSynced = "DataVolume synced successfully"
)
View Source
const (
	// AnnEndpoint provides a const for our PVC endpoint annotation
	AnnEndpoint = "cdi.kubevirt.io/storage.import.endpoint"
	// AnnSecret provides a const for our PVC secretName annotation
	AnnSecret = "cdi.kubevirt.io/storage.import.secretName"
	// AnnImportPod provides a const for our PVC importPodName annotation
	AnnImportPod = "cdi.kubevirt.io/storage.import.importPodName"
	// AnnCreatedBy provides a const for our POD createByController annotation
	AnnCreatedBy = "cdi.kubevirt.io/storage.createdByController"
	// AnnPodPhase provides a const for our POD phase annotation
	AnnPodPhase = "cdi.kubevirt.io/storage.import.pod.phase"
	// LabelImportPvc provides a const for our importPvcName
	LabelImportPvc = "cdi.kubevirt.io/storage.import.importPvcName"
)
View Source
const DataVolName = "cdi-data-vol"

DataVolName provides a const to use for creating volumes in pod specs

View Source
const ImagePathName = "image-path"

ImagePathName provides a const to use for creating volumes in pod specs

Variables

This section is empty.

Functions

func CreateCloneSourcePod

func CreateCloneSourcePod(client kubernetes.Interface, image string, verbose 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, verbose 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, ep, secretName string, 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 MakeCloneSourcePodSpec

func MakeCloneSourcePodSpec(image, verbose, 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, verbose, 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, ep, secret string, pvc *v1.PersistentVolumeClaim) *v1.Pod

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

func ParseSourcePvcAnnotation

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

ParseSourcePvcAnnotation parses out the annotations for a CDI PVC

Types

type CloneController

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

CloneController represents the CDI Clone Controller

func NewCloneController

func NewCloneController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	cloneImage 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 (c *CloneController) ProcessNextPvcItem() bool

ProcessNextPvcItem selects pvcs with the 'CloneRequest' annotation and that are not being processed. We forget the key unless `processPvcItem` returns an error in which case the key can be retried.

func (*CloneController) Run

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

Run kicks off an initialized CloneController, creating a service that listens for, and processes CDI Clone Requests

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 ImportController

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

ImportController represents a CDI Import Controller

func NewImportController

func NewImportController(client kubernetes.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	importerImage 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 (c *ImportController) ProcessNextPvcItem() bool

ProcessNextPvcItem processes pvcs with the importer endpoint annotation and that are not being processed. We forget the key unless `processPvcItem` returns an error in which case the key can be retried.

func (*ImportController) Run

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

Run kicks off an initialized Import Controller, creating a service that listens for, and process CDI Import Requests

Jump to

Keyboard shortcuts

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