Documentation ¶
Index ¶
- Constants
- Variables
- func AddAnnotation(obj metav1.Object, key, value string)
- func AddFinalizer(obj metav1.Object, name string)
- func CreateScratchPersistentVolumeClaim(client client.Client, pvc *v1.PersistentVolumeClaim, pod *v1.Pod, ...) (*v1.PersistentVolumeClaim, error)
- func DecodePublicKey(keyBytes []byte) (*rsa.PublicKey, error)
- func FindDataImportCronConditionByType(cron *cdiv1.DataImportCron, conditionType cdiv1.DataImportCronConditionType) *cdiv1.DataImportCronCondition
- func FindDataSourceConditionByType(ds *cdiv1.DataSource, conditionType cdiv1.DataSourceConditionType) *cdiv1.DataSourceCondition
- func GetActiveCDI(c client.Client) (*cdiv1.CDI, error)
- func GetClusterWideProxy(r client.Client) (*ocpconfigv1.Proxy, error)
- func GetContentType(pvc *corev1.PersistentVolumeClaim) string
- func GetCronJobName(cron *cdiv1.DataImportCron) string
- func GetDataVolumeClaimName(dv *cdiv1.DataVolume) string
- func GetDefaultPodResourceRequirements(client client.Client) (*v1.ResourceRequirements, error)
- func GetDefaultStorageClass(client client.Client) (*storagev1.StorageClass, error)
- func GetFilesystemOverhead(client client.Client, pvc *v1.PersistentVolumeClaim) (cdiv1.Percent, error)
- func GetFilesystemOverheadForStorageClass(client client.Client, storageClassName *string) (cdiv1.Percent, error)
- func GetImportProxyConfig(config *cdiv1.CDIConfig, field string) (string, error)
- func GetInitialJobName(cron *cdiv1.DataImportCron) string
- func GetPodsUsingPVCs(c client.Client, namespace string, names sets.String, allowReadOnly bool) ([]v1.Pod, error)
- func GetPreallocation(client client.Client, dataVolume *cdiv1.DataVolume) bool
- func GetRequiredSpace(filesystemOverhead float64, requestedSpace int64) int64
- func GetScratchPvcStorageClass(client client.Client, pvc *v1.PersistentVolumeClaim) string
- func GetStorageClassByName(client client.Client, name *string) (*storagev1.StorageClass, error)
- func GetUploadServerURL(namespace, pvc, uploadPath string) string
- func GetVolumeMode(pvc *v1.PersistentVolumeClaim) v1.PersistentVolumeMode
- func GetWorkloadNodePlacement(c client.Client) (*sdkapi.NodePlacement, error)
- func HasFinalizer(object metav1.Object, value string) bool
- func IgnoreIsNoMatchError(err error) error
- func IgnoreNotFound(err error) error
- func IsCsiCrdsDeployed(c client.Client, log logr.Logger) bool
- func IsInsecureTLS(ep string, cdiConfig *cdiv1.CDIConfig, client client.Client, log logr.Logger) (bool, error)
- func IsPopulated(pvc *v1.PersistentVolumeClaim, c client.Client) (bool, error)
- func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, ...) *corev1.Pod
- func MakeEmptyCDICR() *cdiv1.CDI
- func MakeEmptyCDIConfigSpec(name string) *cdiv1.CDIConfig
- func MakeEmptyStorageProfileSpec(name string) *cdiv1.StorageProfile
- func MakePVCOwnerReference(pvc *v1.PersistentVolumeClaim) metav1.OwnerReference
- func MakePodOwnerReference(pod *v1.Pod) metav1.OwnerReference
- func NewCloneController(mgr manager.Manager, log logr.Logger, image, pullPolicy, verbose string, ...) (controller.Controller, error)
- func NewConfigController(mgr manager.Manager, log logr.Logger, ...) (controller.Controller, error)
- func NewDataImportCronController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy string, ...) (controller.Controller, error)
- func NewDataSourceController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
- func NewDatavolumeController(ctx context.Context, mgr manager.Manager, log logr.Logger, ...) (controller.Controller, error)
- func NewImportController(mgr manager.Manager, log logr.Logger, ...) (controller.Controller, error)
- func NewSmartCloneController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
- func NewStorageProfileController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
- func NewUploadController(mgr manager.Manager, log logr.Logger, uploadImage, pullPolicy, verbose string, ...) (controller.Controller, error)
- func ParseCloneRequestAnnotation(pvc *corev1.PersistentVolumeClaim) (exists bool, namespace, name string)
- func RemoveFinalizer(obj metav1.Object, name string)
- func RenderPvcSpec(client client.Client, recorder record.EventRecorder, log logr.Logger, ...) (*v1.PersistentVolumeClaimSpec, error)
- func SetPodPvcAnnotations(pod *v1.Pod, pvc *v1.PersistentVolumeClaim)
- func UploadPossibleForPVC(pvc *v1.PersistentVolumeClaim) error
- func ValidateCanCloneSourceAndTargetContentType(sourcePvc, targetPvc *corev1.PersistentVolumeClaim) (cdiv1.DataVolumeContentType, error)
- func ValidateCanCloneSourceAndTargetSpec(c client.Client, sourcePvc, targetPvc *corev1.PersistentVolumeClaim, ...) error
- func ValidateClone(sourcePVC *v1.PersistentVolumeClaim, spec *cdiv1.DataVolumeSpec) error
- func ValidateRequestedCloneSize(sourceResources corev1.ResourceRequirements, ...) error
- type CDIConfigReconciler
- type CloneReconciler
- type DataImportCronReconciler
- type DataSourceReconciler
- type DataVolumeEvent
- type DatavolumeReconciler
- type ImportReconciler
- type SmartCloneReconciler
- type StorageProfileReconciler
- type UploadPodArgs
- type UploadReconciler
Constants ¶
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" // AnnCloneToken is the annotation containing the clone token AnnCloneToken = "cdi.kubevirt.io/storage.clone.token" // AnnExtendedCloneToken is the annotation containing the long term clone token AnnExtendedCloneToken = "cdi.kubevirt.io/storage.extended.clone.token" //CloneUniqueID is used as a special label to be used when we search for the pod CloneUniqueID = "cdi.kubevirt.io/storage.clone.cloneUniqeId" // AnnCloneSourcePod name of the source clone pod AnnCloneSourcePod = "cdi.kubevirt.io/storage.sourceClonePodName" // ErrIncompatiblePVC provides a const to indicate a clone is not possible due to an incompatible PVC ErrIncompatiblePVC = "ErrIncompatiblePVC" // TokenKeyDir is the path to the apiserver public key dir TokenKeyDir = "/var/run/cdi/token/keys" // TokenPublicKeyPath is the path to the apiserver public key TokenPublicKeyPath = TokenKeyDir + "/id_rsa.pub" // TokenPrivateKeyPath is the path to the apiserver private key TokenPrivateKeyPath = TokenKeyDir + "/id_rsa" // CloneSucceededPVC provides a const to indicate a clone to the PVC succeeded CloneSucceededPVC = "CloneSucceeded" // CloneSourceInUse is reason for event created when clone source pvc is in use CloneSourceInUse = "CloneSourceInUse" )
const ( // ErrDataSourceAlreadyManaged provides a const to indicate DataSource already managed error ErrDataSourceAlreadyManaged = "ErrDataSourceAlreadyManaged" // MessageDataSourceAlreadyManaged provides a const to form DataSource already managed error message MessageDataSourceAlreadyManaged = "DataSource %s is already managed by DataImportCron %s" )
const ( // AnnSourceDesiredDigest is the digest of the pending updated image AnnSourceDesiredDigest = AnnAPIGroup + "/storage.import.sourceDesiredDigest" // AnnImageStreamDockerRef is the ImageStream Docker reference AnnImageStreamDockerRef = AnnAPIGroup + "/storage.import.imageStreamDockerRef" // AnnNextCronTime is the next time stamp which satisfies the cron expression AnnNextCronTime = AnnAPIGroup + "/storage.import.nextCronTime" // AnnLastCronTime is the cron last execution time stamp AnnLastCronTime = AnnAPIGroup + "/storage.import.lastCronTime" // AnnLastAppliedConfig is the cron last applied configuration AnnLastAppliedConfig = AnnAPIGroup + "/lastAppliedConfiguration" )
const ( // SuccessSynced provides a const to represent a Synced status SuccessSynced = "Synced" // ErrResourceExists provides a const to indicate a resource exists error ErrResourceExists = "ErrResourceExists" // ErrResourceMarkedForDeletion provides a const to indicate a resource marked for deletion error ErrResourceMarkedForDeletion = "ErrResourceMarkedForDeletion" // 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" // ErrClaimNotValid provides a const to indicate a claim is not valid ErrClaimNotValid = "ErrClaimNotValid" // ErrExceededQuota provides a const to indicate the claim has exceeded the quota ErrExceededQuota = "ErrExceededQuota" // ErrUnableToClone provides a const to indicate some errors are blocking the clone ErrUnableToClone = "ErrUnableToClone" // 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" // ImportPaused provides a const to indicate that a multistage import is waiting for the next stage ImportPaused = "ImportPaused" // CloneScheduled provides a const to indicate clone is scheduled CloneScheduled = "CloneScheduled" // CloneInProgress provides a const to indicate clone is in progress CloneInProgress = "CloneInProgress" // SnapshotForSmartCloneInProgress provides a const to indicate snapshot creation for smart-clone is in progress SnapshotForSmartCloneInProgress = "SnapshotForSmartCloneInProgress" // SnapshotForSmartCloneCreated provides a const to indicate snapshot creation for smart-clone has been completed SnapshotForSmartCloneCreated = "SnapshotForSmartCloneCreated" // SmartClonePVCInProgress provides a const to indicate snapshot creation for smart-clone is in progress SmartClonePVCInProgress = "SmartClonePVCInProgress" // SmartCloneSourceInUse provides a const to indicate a smart clone is being delayed because the source is in use SmartCloneSourceInUse = "SmartCloneSourceInUse" // CSICloneInProgress provides a const to indicate csi volume clone is in progress CSICloneInProgress = "CSICloneInProgress" // CSICloneSourceInUse provides a const to indicate a csi volume clone is being delayed because the source is in use CSICloneSourceInUse = "CSICloneSourceInUse" // HostAssistedCloneSourceInUse provides a const to indicate a host-assisted clone is being delayed because the source is in use HostAssistedCloneSourceInUse = "HostAssistedCloneSourceInUse" // 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" // MessageResourceMarkedForDeletion provides a const to form a resource marked for deletion error message MessageResourceMarkedForDeletion = "Resource %q marked for deletion" // 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" // MessageImportPaused provides a const for a "multistage import paused" message MessageImportPaused = "Multistage import into PVC %s is paused" // 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" // MessageSmartCloneInProgress provides a const to form snapshot for smart-clone is in progress message MessageSmartCloneInProgress = "Creating snapshot for smart-clone is in progress (for pvc %s/%s)" // MessageSmartClonePVCInProgress provides a const to form snapshot for smart-clone is in progress message MessageSmartClonePVCInProgress = "Creating PVC for smart-clone is in progress (for pvc %s/%s)" // MessageCsiCloneInProgress provides a const to form a CSI Volume Clone in progress message MessageCsiCloneInProgress = "CSI Volume clone in progress (for pvc %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" // MessageSizeDetectionPodFailed provides a const to indicate that the size-detection pod wasn't able to obtain the image size MessageSizeDetectionPodFailed = "Size-detection pod failed due to %s" // ExpansionInProgress is const representing target PVC expansion ExpansionInProgress = "ExpansionInProgress" // MessageExpansionInProgress is a const for reporting target expansion MessageExpansionInProgress = "Expanding PersistentVolumeClaim for DataVolume %s/%s" // NamespaceTransferInProgress is const representing target PVC transfer NamespaceTransferInProgress = "NamespaceTransferInProgress" // MessageNamespaceTransferInProgress is a const for reporting target transfer MessageNamespaceTransferInProgress = "Transferring PersistentVolumeClaim for DataVolume %s/%s" // SizeDetectionPodCreated provides a const to indicate that the size-detection pod has been created (reason) SizeDetectionPodCreated = "SizeDetectionPodCreated" // MessageSizeDetectionPodCreated provides a const to indicate that the size-detection pod has been created (message) MessageSizeDetectionPodCreated = "Size-detection pod created" // SizeDetectionPodNotReady reports that the size-detection pod has not finished its exectuion (reason) SizeDetectionPodNotReady = "SizeDetectionPodNotReady" // MessageSizeDetectionPodNotReady reports that the size-detection pod has not finished its exectuion (message) MessageSizeDetectionPodNotReady = "The size detection pod is not finished yet" // ImportPVCNotReady reports that it's not yet possible to access the source PVC (reason) ImportPVCNotReady = "ImportPVCNotReady" // MessageImportPVCNotReady reports that it's not yet possible to access the source PVC (message) MessageImportPVCNotReady = "The source PVC is not fully imported" // CloneValidationFailed reports that a clone wasn't admitted by our validation mechanism (reason) CloneValidationFailed = "CloneValidationFailed" // MessageCloneValidationFailed reports that a clone wasn't admitted by our validation mechanism (message) MessageCloneValidationFailed = "The clone doesn't meet the validation requirements" // CloneWithoutSource reports that the source PVC of a clone doesn't exists (reason) CloneWithoutSource = "CloneWithoutSource" // MessageCloneWithoutSource reports that the source PVC of a clone doesn't exists (message) MessageCloneWithoutSource = "The source PVC doesn't exist" // AnnCSICloneRequest annotation associates object with CSI Clone Request AnnCSICloneRequest = "cdi.kubevirt.io/CSICloneRequest" // AnnVirtualImageSize annotation contains the Virtual Image size of a PVC used for host-assisted cloning AnnVirtualImageSize = "cdi.Kubervirt.io/virtualSize" // AnnSourceCapacity annotation contains the storage capacity of a PVC used for host-assisted cloning AnnSourceCapacity = "cdi.Kubervirt.io/sourceCapacity" // AnnPermissiveClone annotation allows the clone-controller to skip the clone size validation AnnPermissiveClone = "cdi.Kubevirt.io/permissiveClone" )
const ( NoClone cloneStrategy = iota HostAssistedClone SmartClone CsiClone )
Possible clone strategies, including default special value NoClone
const ( NoErr int = iota ErrBadArguments ErrInvalidFile ErrInvalidPath ErrBadTermFile ErrUnknown )
Size-detection pod error codes
const ( // 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" // SourceImageio is the source type ovirt-imageio SourceImageio = "imageio" // SourceVDDK is the source type of VDDK SourceVDDK = "vddk" // 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" // AnnCertConfigMap is the name of a configmap containing tls certs AnnCertConfigMap = AnnAPIGroup + "/storage.import.certConfigMap" // AnnContentType provides a const for the PVC content-type AnnContentType = AnnAPIGroup + "/storage.contentType" // AnnRegistryImportMethod provides a const for registry import method annotation AnnRegistryImportMethod = AnnAPIGroup + "/storage.import.registryImportMethod" // AnnRegistryImageStream provides a const for registry image stream annotation AnnRegistryImageStream = AnnAPIGroup + "/storage.import.registryImageStream" // AnnImportPod provides a const for our PVC importPodName annotation AnnImportPod = AnnAPIGroup + "/storage.import.importPodName" // AnnRequiresScratch provides a const for our PVC requires scratch annotation AnnRequiresScratch = AnnAPIGroup + "/storage.import.requiresScratch" // AnnDiskID provides a const for our PVC diskId annotation AnnDiskID = AnnAPIGroup + "/storage.import.diskId" // AnnUUID provides a const for our PVC uuid annotation AnnUUID = AnnAPIGroup + "/storage.import.uuid" // AnnBackingFile provides a const for our PVC backing file annotation AnnBackingFile = AnnAPIGroup + "/storage.import.backingFile" // AnnThumbprint provides a const for our PVC backing thumbprint annotation AnnThumbprint = AnnAPIGroup + "/storage.import.vddk.thumbprint" // AnnPreallocationApplied provides a const for PVC preallocation annotation AnnPreallocationApplied = AnnAPIGroup + "/storage.preallocation" // AnnExtraHeaders provides a const for our PVC extraHeaders annotation AnnExtraHeaders = AnnAPIGroup + "/storage.import.extraHeaders" // AnnSecretExtraHeaders provides a const for our PVC secretExtraHeaders annotation AnnSecretExtraHeaders = AnnAPIGroup + "/storage.import.secretExtraHeaders" //LabelImportPvc is a pod label used to find the import pod that was created by the relevant PVC LabelImportPvc = AnnAPIGroup + "/storage.import.importPvcName" //AnnDefaultStorageClass is the annotation indicating that a storage class is the default one. AnnDefaultStorageClass = "storageclass.kubernetes.io/is-default-class" // AnnOpenShiftImageLookup is the annotation for OpenShift image stream lookup AnnOpenShiftImageLookup = "alpha.image.policy.openshift.io/resolve-names" // ErrImportFailedPVC provides a const to indicate an import to the PVC failed ErrImportFailedPVC = "ErrImportFailed" // ImportSucceededPVC provides a const to indicate an import to the PVC failed ImportSucceededPVC = "ImportSucceeded" // ImportTargetInUse is reason for event created when an import pvc is in use ImportTargetInUse = "ImportTargetInUse" )
const ( // AnnUploadRequest marks that a PVC should be made available for upload AnnUploadRequest = "cdi.kubevirt.io/storage.upload.target" // AnnUploadClientName is the TLS name uploadserver will accept requests from AnnUploadClientName = "cdi.kubevirt.io/uploadClientName" // AnnUploadPod name of the upload pod AnnUploadPod = "cdi.kubevirt.io/storage.uploadPodName" // UploadSucceededPVC provides a const to indicate an import to the PVC failed UploadSucceededPVC = "UploadSucceeded" // UploadTargetInUse is reason for event created when an upload pvc is in use UploadTargetInUse = "UploadTargetInUse" )
const ( // DataVolName provides a const to use for creating volumes in pod specs DataVolName = "cdi-data-vol" // CertVolName is the name of the volumecontaining certs CertVolName = "cdi-cert-vol" // ScratchVolName provides a const to use for creating scratch pvc volumes in pod specs ScratchVolName = "cdi-scratch-vol" // ImagePathName provides a const to use for creating volumes in pod specs ImagePathName = "image-path" // AnnAPIGroup is the APIGroup for CDI AnnAPIGroup = "cdi.kubevirt.io" // AnnCreatedBy is a pod annotation indicating if the pod was created by the PVC AnnCreatedBy = AnnAPIGroup + "/storage.createdByController" // AnnPodPhase is a PVC annotation indicating the related pod progress (phase) AnnPodPhase = AnnAPIGroup + "/storage.pod.phase" // AnnPodReady tells whether the pod is ready AnnPodReady = AnnAPIGroup + "/storage.pod.ready" // AnnOwnerRef is used when owner is in a different namespace AnnOwnerRef = AnnAPIGroup + "/storage.ownerRef" // AnnPodRestarts is a PVC annotation that tells how many times a related pod was restarted AnnPodRestarts = AnnAPIGroup + "/storage.pod.restarts" // AnnPopulatedFor is a PVC annotation telling the datavolume controller that the PVC is already populated AnnPopulatedFor = AnnAPIGroup + "/storage.populatedFor" // AnnPrePopulated is a PVC annotation telling the datavolume controller that the PVC is already populated AnnPrePopulated = AnnAPIGroup + "/storage.prePopulated" // AnnPriorityClassName is PVC annotation to indicate the priority class name for importer, cloner and uploader pod AnnPriorityClassName = AnnAPIGroup + "/storage.pod.priorityclassname" // AnnDeleteAfterCompletion is PVC annotation for deleting DV after completion AnnDeleteAfterCompletion = AnnAPIGroup + "/storage.deleteAfterCompletion" // AnnPodRetainAfterCompletion is PVC annotation for retaining transfer pods after completion AnnPodRetainAfterCompletion = AnnAPIGroup + "/storage.pod.retainAfterCompletion" // AnnPreviousCheckpoint provides a const to indicate the previous snapshot for a multistage import AnnPreviousCheckpoint = AnnAPIGroup + "/storage.checkpoint.previous" // AnnCurrentCheckpoint provides a const to indicate the current snapshot for a multistage import AnnCurrentCheckpoint = AnnAPIGroup + "/storage.checkpoint.current" // AnnFinalCheckpoint provides a const to indicate whether the current checkpoint is the last one AnnFinalCheckpoint = AnnAPIGroup + "/storage.checkpoint.final" // AnnCheckpointsCopied is a prefix for recording which checkpoints have already been copied AnnCheckpointsCopied = AnnAPIGroup + "/storage.checkpoint.copied" // AnnCurrentPodID keeps track of the latest pod servicing this PVC AnnCurrentPodID = AnnAPIGroup + "/storage.checkpoint.pod.id" // AnnMultiStageImportDone marks a multi-stage import as totally finished AnnMultiStageImportDone = AnnAPIGroup + "/storage.checkpoint.done" // AnnPreallocationRequested provides a const to indicate whether preallocation should be performed on the PV AnnPreallocationRequested = AnnAPIGroup + "/storage.preallocation.requested" // AnnRunningCondition provides a const for the running condition AnnRunningCondition = AnnAPIGroup + "/storage.condition.running" // AnnRunningConditionMessage provides a const for the running condition AnnRunningConditionMessage = AnnAPIGroup + "/storage.condition.running.message" // AnnRunningConditionReason provides a const for the running condition AnnRunningConditionReason = AnnAPIGroup + "/storage.condition.running.reason" // AnnBoundCondition provides a const for the running condition AnnBoundCondition = AnnAPIGroup + "/storage.condition.bound" // AnnBoundConditionMessage provides a const for the running condition AnnBoundConditionMessage = AnnAPIGroup + "/storage.condition.bound.message" // AnnBoundConditionReason provides a const for the running condition AnnBoundConditionReason = AnnAPIGroup + "/storage.condition.bound.reason" // AnnSourceRunningCondition provides a const for the running condition AnnSourceRunningCondition = AnnAPIGroup + "/storage.condition.source.running" // AnnSourceRunningConditionMessage provides a const for the running condition AnnSourceRunningConditionMessage = AnnAPIGroup + "/storage.condition.source.running.message" // AnnSourceRunningConditionReason provides a const for the running condition AnnSourceRunningConditionReason = AnnAPIGroup + "/storage.condition.source.running.reason" // AnnImmediateBinding provides a const to indicate whether immediate binding should be performed on the PV (overrides global config) AnnImmediateBinding = AnnAPIGroup + "/storage.bind.immediate.requested" // AnnVddkVersion shows the last VDDK library version used by a DV's importer pod AnnVddkVersion = AnnAPIGroup + "/storage.pod.vddk.version" // AnnVddkHostConnection shows the last ESX host that serviced a DV's importer pod AnnVddkHostConnection = AnnAPIGroup + "/storage.pod.vddk.host" // AnnVddkInitImageURL saves a per-DV VDDK image URL on the PVC AnnVddkInitImageURL = AnnAPIGroup + "/storage.pod.vddk.initimageurl" // ProxyCertVolName is the name of the volumecontaining certs ProxyCertVolName = "cdi-proxy-cert-vol" // ClusterWideProxyAPIGroup is the APIGroup for OpenShift Cluster Wide Proxy ClusterWideProxyAPIGroup = "config.openshift.io" // ClusterWideProxyAPIKind is the APIKind for OpenShift Cluster Wide Proxy ClusterWideProxyAPIKind = "Proxy" // ClusterWideProxyAPIVersion is the APIVersion for OpenShift Cluster Wide Proxy ClusterWideProxyAPIVersion = "v1" // ClusterWideProxyName is the OpenShift Cluster Wide Proxy object name. There is only one obj in the cluster. ClusterWideProxyName = "cluster" // ClusterWideProxyConfigMapName is the OpenShift Cluster Wide Proxy ConfigMap name for CA certificates. ClusterWideProxyConfigMapName = "user-ca-bundle" // ClusterWideProxyConfigMapNameSpace is the OpenShift Cluster Wide Proxy ConfigMap namespace for CA certificates. ClusterWideProxyConfigMapNameSpace = "openshift-config" // ClusterWideProxyConfigMapKey is the OpenShift Cluster Wide Proxy ConfigMap key name for CA certificates. ClusterWideProxyConfigMapKey = "ca-bundle.crt" // SecretExtraHeadersVolumeName is the format string that specifies where extra HTTP header secrets will be mounted SecretExtraHeadersVolumeName = "cdi-secret-extra-headers-vol-%d" )
const ( // AnnPodNetwork is used for specifying Pod Network AnnPodNetwork = "k8s.v1.cni.cncf.io/networks" // AnnPodMultusDefaultNetwork is used for specifying default Pod Network AnnPodMultusDefaultNetwork = "v1.multus-cni.io/default-network" // AnnPodSidecarInjection is used for enabling/disabling Pod istio/AspenMesh sidecar injection AnnPodSidecarInjection = "sidecar.istio.io/inject" // AnnPodSidecarInjectionDefault is the default value passed for AnnPodSidecarInjection AnnPodSidecarInjectionDefault = "false" )
const (
AnnConfigAuthority = "cdi.kubevirt.io/configAuthority"
)
AnnConfigAuthority is the annotation specifying a resource as the CDIConfig authority
const (
//AnnSmartCloneRequest sets our expected annotation for a CloneRequest
AnnSmartCloneRequest = "k8s.io/SmartCloneRequest"
)
Variables ¶
var ( // DataImportCronOutdatedGauge is the metric we use to alert about DataImportCrons failing DataImportCronOutdatedGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: monitoring.MetricOptsList[monitoring.DataImportCronOutdated].Name, Help: monitoring.MetricOptsList[monitoring.DataImportCronOutdated].Help, }, []string{prometheusNsLabel, prometheusCronNameLabel}, ) )
var ErrInvalidTermMsg = fmt.Errorf("The termination message from the size-detection pod is not-valid")
ErrInvalidTermMsg reports that the termination message from the size-detection pod doesn't exists or is not a valid quantity
var ( // IncompleteProfileGauge is the metric we use to alert about incomplete storage profiles IncompleteProfileGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Name: monitoring.MetricOptsList[monitoring.IncompleteProfile].Name, Help: monitoring.MetricOptsList[monitoring.IncompleteProfile].Help, }) )
Functions ¶
func AddAnnotation ¶ added in v1.50.0
AddAnnotation adds an annotation to an object
func AddFinalizer ¶ added in v1.34.0
AddFinalizer adds a finalizer to a resource
func CreateScratchPersistentVolumeClaim ¶ added in v1.7.0
func CreateScratchPersistentVolumeClaim(client client.Client, pvc *v1.PersistentVolumeClaim, pod *v1.Pod, name, storageClassName string, installerLabels map[string]string, recorder record.EventRecorder) (*v1.PersistentVolumeClaim, error)
CreateScratchPersistentVolumeClaim creates and returns a pointer to a scratch PVC which is created based on the passed-in pvc and storage class name.
func DecodePublicKey ¶ added in v1.9.4
DecodePublicKey turns a bunch of bytes into a public key
func FindDataImportCronConditionByType ¶ added in v1.42.0
func FindDataImportCronConditionByType(cron *cdiv1.DataImportCron, conditionType cdiv1.DataImportCronConditionType) *cdiv1.DataImportCronCondition
FindDataImportCronConditionByType finds DataImportCronCondition by condition type
func FindDataSourceConditionByType ¶ added in v1.42.0
func FindDataSourceConditionByType(ds *cdiv1.DataSource, conditionType cdiv1.DataSourceConditionType) *cdiv1.DataSourceCondition
FindDataSourceConditionByType finds DataSourceCondition by condition type
func GetActiveCDI ¶ added in v1.26.0
GetActiveCDI returns the active CDI CR
func GetClusterWideProxy ¶ added in v1.31.0
func GetClusterWideProxy(r client.Client) (*ocpconfigv1.Proxy, error)
GetClusterWideProxy returns the OpenShift cluster wide proxy object
func GetContentType ¶ added in v1.31.0
func GetContentType(pvc *corev1.PersistentVolumeClaim) string
GetContentType returns the content type of the source image. If invalid or not set, default to kubevirt
func GetCronJobName ¶ added in v1.41.1
func GetCronJobName(cron *cdiv1.DataImportCron) string
GetCronJobName get CronJob name based on cron name and UID
func GetDataVolumeClaimName ¶ added in v1.31.0
func GetDataVolumeClaimName(dv *cdiv1.DataVolume) string
GetDataVolumeClaimName returns the PVC name associated with the DV
func GetDefaultPodResourceRequirements ¶ added in v1.12.0
func GetDefaultPodResourceRequirements(client client.Client) (*v1.ResourceRequirements, error)
GetDefaultPodResourceRequirements gets default pod resource requirements from cdi config status
func GetDefaultStorageClass ¶ added in v1.28.0
func GetDefaultStorageClass(client client.Client) (*storagev1.StorageClass, error)
GetDefaultStorageClass returns the default storage class or nil if none found
func GetFilesystemOverhead ¶ added in v1.24.0
func GetFilesystemOverhead(client client.Client, pvc *v1.PersistentVolumeClaim) (cdiv1.Percent, error)
GetFilesystemOverhead determines the filesystem overhead defined in CDIConfig for this PVC's volumeMode and storageClass.
func GetFilesystemOverheadForStorageClass ¶ added in v1.34.0
func GetFilesystemOverheadForStorageClass(client client.Client, storageClassName *string) (cdiv1.Percent, error)
GetFilesystemOverheadForStorageClass determines the filesystem overhead defined in CDIConfig for the storageClass.
func GetImportProxyConfig ¶ added in v1.31.0
GetImportProxyConfig attempts to import proxy URLs if configured in the CDIConfig.
func GetInitialJobName ¶ added in v1.43.1
func GetInitialJobName(cron *cdiv1.DataImportCron) string
GetInitialJobName get initial job name based on cron name and UID
func GetPodsUsingPVCs ¶ added in v1.31.0
func GetPodsUsingPVCs(c client.Client, namespace string, names sets.String, allowReadOnly bool) ([]v1.Pod, error)
GetPodsUsingPVCs returns Pods currently using PVCs
func GetPreallocation ¶ added in v1.28.0
func GetPreallocation(client client.Client, dataVolume *cdiv1.DataVolume) bool
GetPreallocation retuns the preallocation setting for DV, falling back to StorageClass and global setting (in this order)
func GetRequiredSpace ¶ added in v1.34.0
GetRequiredSpace calculates space required taking file system overhead into account
func GetScratchPvcStorageClass ¶ added in v1.7.0
func GetScratchPvcStorageClass(client client.Client, pvc *v1.PersistentVolumeClaim) string
GetScratchPvcStorageClass tries to determine which storage class to use for use with a scratch persistent volume claim. The order of preference is the following: 1. Defined value in CDI Config field scratchSpaceStorageClass. 2. If 1 is not available, use the storage class name of the original pvc that will own the scratch pvc. 3. If none of those are available, return blank.
func GetStorageClassByName ¶ added in v1.24.0
GetStorageClassByName looks up the storage class based on the name. If no storage class is found returns nil
func GetUploadServerURL ¶ added in v1.10.1
GetUploadServerURL returns the url the proxy should post to for a particular pvc
func GetVolumeMode ¶ added in v1.30.0
func GetVolumeMode(pvc *v1.PersistentVolumeClaim) v1.PersistentVolumeMode
GetVolumeMode returns the volumeMode from PVC handling default empty value
func GetWorkloadNodePlacement ¶ added in v1.23.0
func GetWorkloadNodePlacement(c client.Client) (*sdkapi.NodePlacement, error)
GetWorkloadNodePlacement extracts the workload-specific nodeplacement values from the CDI CR
func HasFinalizer ¶ added in v1.34.0
HasFinalizer returns true if a resource has a specific finalizer
func IgnoreIsNoMatchError ¶ added in v1.12.0
IgnoreIsNoMatchError returns nil if the error is a IsNoMatchError. We will want to ignore this error for optional CRDs, if it is not found, just ignore it.
func IgnoreNotFound ¶ added in v1.12.0
IgnoreNotFound returns nil if the error is a NotFound error. We generally want to ignore (not requeue) NotFound errors, since we'll get a reconciliation request once the object exists, and requeuing in the meantime won't help.
func IsCsiCrdsDeployed ¶ added in v1.10.0
IsCsiCrdsDeployed checks whether the CSI snapshotter CRD are deployed
func IsInsecureTLS ¶ added in v1.41.1
func IsInsecureTLS(ep string, cdiConfig *cdiv1.CDIConfig, client client.Client, log logr.Logger) (bool, error)
IsInsecureTLS checks if TLS security is disabled for the given endpoint
func IsPopulated ¶ added in v1.18.4
IsPopulated returns if the passed in PVC has been populated according to the rules outlined in pkg/apis/core/<version>/utils.go
func MakeCloneSourcePodSpec ¶
func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, pullPolicy, sourcePvcName, sourcePvcNamespace, ownerRefAnno string, serverCACert []byte, targetPvc *corev1.PersistentVolumeClaim, resourceRequirements *corev1.ResourceRequirements, workloadNodePlacement *sdkapi.NodePlacement) *corev1.Pod
MakeCloneSourcePodSpec creates and returns the clone source pod spec based on the target pvc.
func MakeEmptyCDICR ¶ added in v1.23.0
MakeEmptyCDICR creates CDI CustomResouce manifest
func MakeEmptyCDIConfigSpec ¶ added in v1.7.0
MakeEmptyCDIConfigSpec creates cdi config manifest
func MakeEmptyStorageProfileSpec ¶ added in v1.33.0
func MakeEmptyStorageProfileSpec(name string) *cdiv1.StorageProfile
MakeEmptyStorageProfileSpec creates StorageProfile manifest
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 NewCloneController ¶
func NewCloneController(mgr manager.Manager, log logr.Logger, image, pullPolicy, verbose string, clientCertGenerator generator.CertGenerator, serverCAFetcher fetcher.CertBundleFetcher, apiServerKey *rsa.PublicKey, installerLabels map[string]string) (controller.Controller, error)
NewCloneController creates a new instance of the config controller.
func NewConfigController ¶ added in v1.6.0
func NewConfigController(mgr manager.Manager, log logr.Logger, uploadProxyServiceName, configName string, installerLabels map[string]string) (controller.Controller, error)
NewConfigController creates a new instance of the config controller.
func NewDataImportCronController ¶ added in v1.41.1
func NewDataImportCronController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy string, installerLabels map[string]string) (controller.Controller, error)
NewDataImportCronController creates a new instance of the DataImportCron controller
func NewDataSourceController ¶ added in v1.43.0
func NewDataSourceController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
NewDataSourceController creates a new instance of the DataSource controller
func NewDatavolumeController ¶ added in v1.14.0
func NewDatavolumeController( ctx context.Context, mgr manager.Manager, log logr.Logger, clonerImage, importerImage, pullPolicy string, tokenPublicKey *rsa.PublicKey, tokenPrivateKey *rsa.PrivateKey, installerLabels map[string]string, ) (controller.Controller, error)
NewDatavolumeController creates a new instance of the datavolume controller.
func NewImportController ¶
func NewImportController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy, verbose string, installerLabels map[string]string) (controller.Controller, error)
NewImportController creates a new instance of the import controller.
func NewSmartCloneController ¶ added in v1.10.0
func NewSmartCloneController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
NewSmartCloneController creates a new instance of the Smart clone controller.
func NewStorageProfileController ¶ added in v1.33.0
func NewStorageProfileController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
NewStorageProfileController creates a new instance of the StorageProfile controller.
func NewUploadController ¶
func NewUploadController(mgr manager.Manager, log logr.Logger, uploadImage, pullPolicy, verbose string, serverCertGenerator generator.CertGenerator, clientCAFetcher fetcher.CertBundleFetcher, installerLabels map[string]string) (controller.Controller, error)
NewUploadController creates a new instance of the upload controller.
func ParseCloneRequestAnnotation ¶ added in v1.11.0
func ParseCloneRequestAnnotation(pvc *corev1.PersistentVolumeClaim) (exists bool, namespace, name string)
ParseCloneRequestAnnotation parses the clone request annotation
func RemoveFinalizer ¶ added in v1.34.0
RemoveFinalizer removes a finalizer from a resource
func RenderPvcSpec ¶ added in v1.34.0
func RenderPvcSpec(client client.Client, recorder record.EventRecorder, log logr.Logger, dv *cdiv1.DataVolume) (*v1.PersistentVolumeClaimSpec, error)
RenderPvcSpec creates a new PVC Spec based on either the dv.spec.pvc or dv.spec.storage section
func SetPodPvcAnnotations ¶ added in v1.27.0
func SetPodPvcAnnotations(pod *v1.Pod, pvc *v1.PersistentVolumeClaim)
SetPodPvcAnnotations applies PVC annotations on the pod
func UploadPossibleForPVC ¶
func UploadPossibleForPVC(pvc *v1.PersistentVolumeClaim) error
UploadPossibleForPVC is called by the api server to see whether to return an upload token
func ValidateCanCloneSourceAndTargetContentType ¶ added in v1.30.0
func ValidateCanCloneSourceAndTargetContentType(sourcePvc, targetPvc *corev1.PersistentVolumeClaim) (cdiv1.DataVolumeContentType, error)
ValidateCanCloneSourceAndTargetContentType validates the pvcs passed has the same content type.
func ValidateCanCloneSourceAndTargetSpec ¶ added in v1.9.0
func ValidateCanCloneSourceAndTargetSpec(c client.Client, sourcePvc, targetPvc *corev1.PersistentVolumeClaim, contentType cdiv1.DataVolumeContentType) error
ValidateCanCloneSourceAndTargetSpec validates the specs passed in are compatible for cloning.
func ValidateClone ¶ added in v1.43.3
func ValidateClone(sourcePVC *v1.PersistentVolumeClaim, spec *cdiv1.DataVolumeSpec) error
ValidateClone compares a clone spec against its source PVC to validate its creation
func ValidateRequestedCloneSize ¶ added in v1.43.3
func ValidateRequestedCloneSize(sourceResources corev1.ResourceRequirements, targetResources corev1.ResourceRequirements) error
ValidateRequestedCloneSize validates the clone size requirements on block
Types ¶
type CDIConfigReconciler ¶ added in v1.12.0
type CDIConfigReconciler struct {
// contains filtered or unexported fields
}
CDIConfigReconciler members
func (*CDIConfigReconciler) Init ¶ added in v1.12.0
func (r *CDIConfigReconciler) Init() error
Init initializes a CDIConfig object.
type CloneReconciler ¶ added in v1.14.0
type CloneReconciler struct {
// contains filtered or unexported fields
}
CloneReconciler members
func (*CloneReconciler) CreateCloneSourcePod ¶ added in v1.14.0
func (r *CloneReconciler) CreateCloneSourcePod(image, pullPolicy string, pvc *corev1.PersistentVolumeClaim, log logr.Logger) (*corev1.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
type DataImportCronReconciler ¶ added in v1.41.1
type DataImportCronReconciler struct {
// contains filtered or unexported fields
}
DataImportCronReconciler members
type DataSourceReconciler ¶ added in v1.43.0
type DataSourceReconciler struct {
// contains filtered or unexported fields
}
DataSourceReconciler members
type DataVolumeEvent ¶ added in v1.3.0
type DataVolumeEvent struct {
// contains filtered or unexported fields
}
DataVolumeEvent reoresents event
type DatavolumeReconciler ¶ added in v1.14.0
type DatavolumeReconciler struct {
// contains filtered or unexported fields
}
DatavolumeReconciler members
type ImportReconciler ¶ added in v1.12.0
type ImportReconciler struct {
// contains filtered or unexported fields
}
ImportReconciler members
type SmartCloneReconciler ¶ added in v1.15.0
type SmartCloneReconciler struct {
// contains filtered or unexported fields
}
SmartCloneReconciler members
type StorageProfileReconciler ¶ added in v1.33.0
type StorageProfileReconciler struct {
// contains filtered or unexported fields
}
StorageProfileReconciler members
type UploadPodArgs ¶ added in v1.11.0
type UploadPodArgs struct { Name string PVC *v1.PersistentVolumeClaim ScratchPVCName string ClientName string FilesystemOverhead string ServerCert, ServerKey, ClientCA []byte Preallocation string }
UploadPodArgs are the parameters required to create an upload pod
type UploadReconciler ¶ added in v1.14.0
type UploadReconciler struct {
// contains filtered or unexported fields
}
UploadReconciler members