# Functions
AddAnnotation adds an annotation to an object.
AddFinalizer adds a finalizer to a resource.
AddImmediateBindingAnnotationIfWFFCDisabled adds the immediateBinding annotation if wffc feature gate is disabled.
AddImportVolumeMounts is being called for pods using PV with filesystem volume mode.
AddLabel adds a label to an object.
AddVolumeDevices returns VolumeDevice slice with one block device for pods using PV with block volume mode.
AllowClaimAdoption returns true if the PVC may be adopted.
BuildHTTPClient generates an http client that accepts any certificate, since we are using it to get prometheus data it doesn't matter if someone can intercept the data.
BulkDeleteResources deletes a bunch of resources.
ClaimIsPopulatedForDataVolume returns true if the PVC is populated for the given DataVolume.
ClaimMayExistBeforeDataVolume returns true if the PVC may exist before the DataVolume.
CopyAllowedAnnotations copies the allowed annotations from the source object to the destination object.
CopyAllowedLabels copies allowed labels matching the validLabelsMatch regexp from the source map to the destination object allowing overwrites.
CreateClient creates a fake client.
CreateCloneSourcePodName creates clone source pod name.
CreateImporterTestPod creates importer test pod CR.
CreatePvc creates PVC.
CreatePvcInStorageClass creates PVC with storgae class.
CreateStorageClass creates storage class CR.
CreateStorageClassWithProvisioner creates CR of storage class with provisioner.
ErrConnectionRefused checks for connection refused errors.
ErrQuotaExceeded checked is the error is of exceeded quota.
GetActiveCDI returns the active CDI CR.
GetAnnotatedEventSource returns resource referenced by AnnEventSource annotations.
GetAPIServerKey returns API server RSA key.
GetCloneSourceInfo returns the type, name and namespace of the cloning source.
GetContentType returns the content type.
GetDataVolumeTTLSeconds gets the current DataVolume TTL in seconds if GC is enabled, or < 0 if GC is disabled Garbage collection is disabled by default.
GetDefaultPodResourceRequirements gets default pod resource requirements from cdi config status.
GetEndpoint returns the endpoint string which contains the full path URI of the target object to be copied.
GetFilesystemOverheadForStorageClass determines the filesystem overhead defined in CDIConfig for the storageClass.
GetImagePullSecrets gets the imagePullSecrets needed to pull images from the cdi config.
GetMetricsURL builds the metrics URL according to the specified pod.
GetNamespace returns the given namespace if not empty, otherwise the default namespace.
GetNextCheckpoint returns the appropriate checkpoint according to multistage annotations.
GetPlatformDefaultStorageClass returns the default storage class according to the provided annotation or nil if none found.
GetPodFromPvc determines the pod associated with the pvc passed in.
GetPodMetricsPort returns, if exists, the metrics port from the passed pod.
GetPodsUsingPVCs returns Pods currently using PVCs.
GetPreallocation returns the preallocation setting for the specified object (DV or VolumeImportSource), falling back to StorageClass and global setting (in this order).
GetPriorityClass gets PVC priority class.
GetProgressReportFromURL fetches the progress report from the passed URL according to an specific metric expression and ownerUID.
GetPVCContentType returns the content type of the source image.
GetRequestedImageSize returns the PVC requested size.
GetRequiredSpace calculates space required taking file system overhead into account.
GetResource updates given obj with the data of the object with the same name and namespace.
GetSnapshotClassForSmartClone looks up the snapshot class based on the storage class.
GetSource returns the source string which determines the type of source.
GetStorageClassByNameWithK8sFallback looks up the storage class based on the name If name is nil, it looks for the default k8s storage class storageclass.kubernetes.io/is-default-class If no storage class is found, returns nil.
GetStorageClassByNameWithVirtFallback looks up the storage class based on the name If name is nil, it looks for the following, in this order: default kubevirt storage class (if the caller is interested) storageclass.kubevirt.io/is-default-class default k8s storage class storageclass.kubernetes.io/is-default-class If no storage class is found, returns nil.
GetStorageClassFromDVSpec returns the StorageClassName from DataVolume PVC or Storage spec.
GetVolumeMode returns the volumeMode from PVC handling default empty value.
GetVolumeSnapshotClass looks up the snapshot class based on the driver and an optional specific name In case of multiple candidates, it returns the default-annotated one, or the sorted list first one if no such default.
GetWorkloadNodePlacement extracts the workload-specific nodeplacement values from the CDI CR.
HandleFailedPod handles pod-creation errors and updates the pod's PVC without providing sensitive information.
HasFinalizer returns true if a resource has a specific finalizer.
IgnoreIsNoMatchError returns nil if the error is a IsNoMatchError.
IgnoreNotFound returns nil if the error is a NotFound error.
ImmediateBindingRequested returns if an object has the ImmediateBinding annotation.
InflateSizeWithOverhead inflates a storage size with proper overhead calculations.
IsBound returns if the pvc is bound.
IsDataVolumeUsingDefaultStorageClass checks if the DataVolume is using the default StorageClass.
IsErrCacheNotStarted checked is the error is of cache not started.
IsImageStream returns true if registry source is ImageStream.
IsLost returns if the pvc is lost.
IsMultiStageImportInProgress returns true when a PVC is being part of an ongoing multi-stage import.
IsPopulated returns if the passed in PVC has been populated according to the rules outlined in pkg/apis/core/<version>/utils.go.
IsPVBoundToPVC checks if a PV is bound to a specific PVC.
IsPVCComplete returns true if a PVC is in 'Succeeded' phase, false if not.
IsSnapshotReady indicates if a volume snapshot is ready to be used.
IsSnapshotValidForClone returns an error if the passed snapshot is not valid for cloning.
IsUnbound returns if the pvc is not bound yet.
IsWaitForFirstConsumerEnabled tells us if we should respect "real" WFFC behavior or just let our worker pods randomly spawn.
MakeEmptyCDIConfigSpec creates cdi config manifest.
MakeEmptyCDICR creates CDI CustomResouce manifest.
MaybeSetPvcMultiStageAnnotation sets the annotation if pvc needs it, and does not have it yet.
NewCloneTokenValidator returns a new token validator.
NewImportDataVolume returns new import DataVolume CR.
NewMultiTokenValidator returns a new multi token validator.
OwnedByDataVolume returns true if the object is owned by a DataVolume.
Rebind binds the PV of source to target.
RemoveFinalizer removes a finalizer from a resource.
SetNodeNameIfPopulator sets NodeName in a pod spec when the PVC is being handled by a CDI volume populator.
SetRestrictedSecurityContext sets the pod security params to be compatible with restricted PSA.
ShouldDeletePod returns whether the PVC workload pod should be deleted.
ShouldIgnorePod checks if a pod should be ignored.
UpdateGCSAnnotations updates the passed annotations for proper GCS import.
UpdateHTTPAnnotations updates the passed annotations for proper http import.
UpdateImageIOAnnotations updates the passed annotations for proper imageIO import.
UpdateRegistryAnnotations updates the passed annotations for proper registry import.
UpdateS3Annotations updates the passed annotations for proper S3 import.
UpdatesMultistageImportSucceeded handles multi-stage annotations when the importer pod is succeeded.
UpdateVDDKAnnotations updates the passed annotations for proper VDDK import.
ValidateCloneTokenDV validates clone token for DV.
ValidateCloneTokenPVC validates clone token for source and target PVCs.
ValidateRequestedCloneSize validates the clone size requirements on block.
ValidateSnapshotCloneProvisioners validates the target PVC storage class against the snapshot class provisioner.
ValidateSnapshotCloneSize does proper size validation when doing a clone from snapshot operation.
# Constants
AnnAllowClaimAdoption is the annotation that allows a claim to be adopted by a DataVolume.
AnnAPIGroup is the APIGroup for CDI.
AnnBackingFile provides a const for our PVC backing file annotation.
AnnBoundCondition provides a const for the running condition.
AnnBoundConditionMessage provides a const for the running condition.
AnnBoundConditionReason provides a const for the running condition.
AnnCdiCustomizeComponentHash annotation is a hash of all customizations that live under spec.CustomizeComponents.
AnnCertConfigMap is the name of a configmap containing tls certs.
AnnCheckpointsCopied is a prefix for recording which checkpoints have already been copied.
AnnCheckStaticVolume checks if a statically allocated PV exists before creating the target PVC.
AnnCloneOf is used to indicate that cloning was complete.
AnnCloneRequest sets our expected annotation for a CloneRequest.
AnnCloneSourcePod name of the source clone pod.
AnnCloneToken is the annotation containing the clone token.
AnnCloneType is the comuuted/requested clone type.
AnnContentType provides a const for the PVC content-type.
AnnCreatedBy is a pod annotation indicating if the pod was created by the PVC.
AnnCreatedForDataVolume stores the UID of the datavolume that the PVC was created for.
AnnCurrentCheckpoint provides a const to indicate the current snapshot for a multistage import.
AnnCurrentPodID keeps track of the latest pod servicing this PVC.
AnnDefaultSnapshotClass is the annotation indicating that a snapshot class is the default one.
AnnDefaultStorageClass is the annotation indicating that a storage class is the default one.
AnnDefaultVirtStorageClass is the annotation indicating that a storage class is the default one for virtualization purposes.
AnnDeleteAfterCompletion is PVC annotation for deleting DV after completion.
AnnDiskID provides a const for our PVC diskId annotation.
AnnEndpoint provides a const for our PVC endpoint annotation.
AnnEventSource is the source that should be related to events (namespace/name).
AnnEventSourceKind is the source kind that should be related to events.
AnnExtendedCloneToken is the annotation containing the long term clone token.
AnnExternalPopulation annotation marks a PVC as "externally populated", allowing the import-controller to skip it.
AnnExtraHeaders provides a const for our PVC extraHeaders annotation.
AnnFinalCheckpoint provides a const to indicate whether the current checkpoint is the last one.
AnnGarbageCollected is a PVC annotation indicating that the PVC was garbage collected.
AnnImmediateBinding provides a const to indicate whether immediate binding should be performed on the PV (overrides global config).
AnnImportPod provides a const for our PVC importPodName annotation.
AnnMultiStageImportDone marks a multi-stage import as totally finished.
AnnOpenShiftImageLookup is the annotation for OpenShift image stream lookup.
AnnOwnerUID annotation has the owner UID.
AnnPermissiveClone annotation allows the clone-controller to skip the clone size validation.
AnnPersistentVolumeList is an annotation storing a list of PV names.
AnnPodMultusDefaultNetwork is used for specifying default Pod Network.
AnnPodNetwork is used for specifying Pod Network.
AnnPodPhase is a PVC annotation indicating the related pod progress (phase).
AnnPodReady tells whether the pod is ready.
AnnPodRestarts is a PVC annotation that tells how many times a related pod was restarted.
AnnPodRetainAfterCompletion is PVC annotation for retaining transfer pods after completion.
AnnPodSidecarInjectionIstio is used for enabling/disabling Pod istio/AspenMesh sidecar injection.
AnnPodSidecarInjectionIstioDefault is the default value passed for AnnPodSidecarInjection.
AnnPodSidecarInjectionLinkerd is used to enable/disable linkerd sidecar injection.
AnnPodSidecarInjectionLinkerdDefault is the default value passed for AnnPodSidecarInjectionLinkerd.
AnnPopulatedFor is a PVC annotation telling the datavolume controller that the PVC is already populated.
AnnPopulatorKind annotation is added to a PVC' to specify the population kind, so it's later checked by the common populator watches.
AnnPopulatorProgress is a standard annotation that can be used progress reporting.
AnnPreallocationApplied provides a const for PVC preallocation annotation.
AnnPreallocationRequested provides a const to indicate whether preallocation should be performed on the PV.
AnnPrePopulated is a PVC annotation telling the datavolume controller that the PVC is already populated.
AnnPreviousCheckpoint provides a const to indicate the previous snapshot for a multistage import.
AnnPriorityClassName is PVC annotation to indicate the priority class name for importer, cloner and uploader pod.
AnnRegistryImageStream provides a const for registry image stream annotation.
AnnRegistryImportMethod provides a const for registry import method annotation.
AnnRequiresDirectIO provides a const for our PVC requiring direct io annotation (due to OOMs we need to try qemu cache=none).
AnnRequiresScratch provides a const for our PVC requiring scratch annotation.
AnnRunningCondition provides a const for the running condition.
AnnRunningConditionMessage provides a const for the running condition.
AnnRunningConditionReason provides a const for the running condition.
AnnSecret provides a const for our PVC secretName annotation.
AnnSecretExtraHeaders provides a const for our PVC secretExtraHeaders annotation.
AnnSelectedNode annotation is added to a PVC that has been triggered by scheduler to be dynamically provisioned.
AnnSource provide a const for our PVC import source annotation.
AnnSourceRunningCondition provides a const for the running condition.
AnnSourceRunningConditionMessage provides a const for the running condition.
AnnSourceRunningConditionReason provides a const for the running condition.
AnnSourceVolumeMode is the volume mode of the source PVC specified as an annotation on snapshots.
AnnThumbprint provides a const for our PVC backing thumbprint annotation.
AnnUploadRequest marks that a PVC should be made available for upload.
AnnUsePopulator annotation indicates if the datavolume population will use populators.
AnnUUID provides a const for our PVC uuid annotation.
AnnVddkExtraArgs references a ConfigMap that holds arguments to pass directly to the VDDK library.
AnnVddkHostConnection shows the last ESX host that serviced a DV's importer pod.
AnnVddkInitImageURL saves a per-DV VDDK image URL on the PVC.
AnnVddkVersion shows the last VDDK library version used by a DV's importer pod.
ClaimLost reason const.
CloneComplete message.
CloneSourceInUse is reason for event created when clone source pvc is in use.
CloneUniqueID is used as a special label to be used when we search for the pod.
DataVolName provides a const to use for creating volumes in pod specs.
Size-detection pod error codes.
Size-detection pod error codes.
ErrClaimNotValid provides a const to indicate a claim is not valid.
ErrExceededQuota provides a const to indicate the claim has exceeded the quota.
ErrIncompatiblePVC provides a const to indicate a clone is not possible due to an incompatible PVC.
Size-detection pod error codes.
Size-detection pod error codes.
ErrStartingPod provides a const to indicate that a pod wasn't able to start without providing sensitive information (reason).
Size-detection pod error codes.
ImportPaused provides a const to indicate that a multistage import is waiting for the next stage.
LabelDefaultInstancetype provides a default VirtualMachine{ClusterInstancetype,Instancetype} that can be used by a VirtualMachine booting from a given PVC.
LabelDefaultInstancetypeKind provides a default kind of either VirtualMachineClusterInstancetype or VirtualMachineInstancetype.
LabelDefaultPreference provides a default VirtualMachine{ClusterPreference,Preference} that can be used by a VirtualMachine booting from a given PVC.
LabelDefaultPreferenceKind provides a default kind of either VirtualMachineClusterPreference or VirtualMachinePreference.
LabelDynamicCredentialSupport specifies if the OS supports updating credentials at runtime.nolint:gosec // These are not credentials.
LabelExcludeFromVeleroBackup provides a const to indicate whether an object should be excluded from velero backup.
MessageDefaultVolumeSnapshotClassSelected reports that the default VolumeSnapshotClass was selected.
MessageErrStartingPod provides a const to indicate that a pod wasn't able to start without providing sensitive information (message).
MessageFirstVolumeSnapshotClassSelected reports that the first VolumeSnapshotClass was selected.
MessageImportPaused provides a const for a "multistage import paused" message.
MessageStorageProfileVolumeSnapshotClassSelected reports that a VolumeSnapshotClass was selected according to StorageProfile.
Size-detection pod error codes.
NotFound reason const.
OOMKilledReason provides a value that container runtimes must return in the reason field for an OOMKilled container.
ProgressDone this means we are DONE.
ScratchVolName provides a const to use for creating scratch pvc volumes in pod specs.
SourceGCS is the source type GCS.
SourceGlance is the source type of glance.
SourceHTTP is the source type HTTP, if unspecified or invalid, it defaults to SourceHTTP.
SourceImageio is the source type ovirt-imageio.
SourceNone means there is no source.
SourceRegistry is the source type of Registry.
SourceS3 is the source type S3.
SourceVDDK is the source type of VDDK.
VolumeSnapshotClassSelected reports that a VolumeSnapshotClass was selected.
# Variables
BlockMode is raw block device mode.
DefaultInstanceTypeLabels is a list of currently supported default instance type labels.
FilesystemMode is filesystem device mode.
# Structs
CheckpointArgs is a struct used to store all checkpoint-related arguments to simplify passing them.
CheckpointRecord is set after comparing the list of checkpoints in the DataVolume/VolumeImportSource spec with the annotations on the PVC indicating which checkpoints have already been copied.
FakeValidator is a fake token validator.
MultiTokenValidator is a token validator that can validate both short and long tokens.
PatchArgs are the args for Patch.