Documentation ¶
Index ¶
- Constants
- Variables
- func AddInsecureRegistry(c client.Client, registryURL string) error
- func ArchiveFiles(targetFile, tgtDir string, sourceFilesNames ...string) (string, error)
- func CacheTestsData(client *kubernetes.Clientset, cdiNs string)
- func CleanupDvPvc(k8sClient *kubernetes.Clientset, cdiClient *cdiclientset.Clientset, ...)
- func CleanupDvPvcNoWait(k8sClient *kubernetes.Clientset, cdiClient *cdiclientset.Clientset, ...)
- func ConfigureCloneStrategy(client client.Client, clientSet *cdiclientset.Clientset, ...) error
- func CopyConfigMap(client kubernetes.Interface, ...) (string, error)
- func CopyFileHostCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
- func CopyImageIOCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
- func CopyRegistryCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
- func CopyRegistryCertConfigMapDestName(client kubernetes.Interface, destNamespace, cdiNamespace, destName string) (string, error)
- func CreateCertConfigMapWeirdFilename(client kubernetes.Interface, destNamespace, srcNamespace string) (string, error)
- func CreateCertForTestService(...) error
- func CreateDataVolumeFromDefinition(clientSet *cdiclientset.Clientset, namespace string, def *cdiv1.DataVolume) (*cdiv1.DataVolume, error)
- func CreatePVCFromDefinition(clientSet *kubernetes.Clientset, namespace string, ...) (*k8sv1.PersistentVolumeClaim, error)
- func CreatePVFromDefinition(clientSet *kubernetes.Clientset, def *k8sv1.PersistentVolume) (*k8sv1.PersistentVolume, error)
- func CreatePod(clientSet *kubernetes.Clientset, namespace string, podDef *k8sv1.Pod) (*k8sv1.Pod, error)
- func CreateSecretFromDefinition(c *kubernetes.Clientset, secret *v1.Secret) (*v1.Secret, error)
- func DeleteConfigMap(client kubernetes.Interface, namespace, name string) error
- func DeleteDataVolume(clientSet *cdiclientset.Clientset, namespace, name string) error
- func DeletePV(clientSet *kubernetes.Clientset, pv *k8sv1.PersistentVolume) error
- func DeletePVC(clientSet *kubernetes.Clientset, namespace, pvcName string) error
- func DeletePod(clientSet *kubernetes.Clientset, pod *k8sv1.Pod, namespace string) error
- func DeletePodByName(clientSet *kubernetes.Clientset, podName, namespace string, gracePeriod *int64) error
- func DeletePodNoGrace(clientSet *kubernetes.Clientset, pod *k8sv1.Pod, namespace string) error
- func DeleteSecret(clientSet *kubernetes.Clientset, namespace string, secret v1.Secret) error
- func DeleteVerifierPod(clientSet *kubernetes.Clientset, namespace string) error
- func DisableFeatureGate(c client.Client, featureGate string) (*bool, error)
- func EnableFeatureGate(c client.Client, feature string) (*bool, error)
- func FindPVC(clientSet *kubernetes.Clientset, namespace, pvcName string) (*k8sv1.PersistentVolumeClaim, error)
- func FindPodByPrefix(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
- func FindPodByPrefixOnce(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
- func FindPodBySuffix(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)
- func FindPodBySuffixOnce(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)
- func FormatTestData(srcFile, tgtDir string, targetFormats ...string) (string, error)
- func GetCloneType(clientSet *cdiclientset.Clientset, dataVolume *cdiv1.DataVolume) string
- func GetDefaultStorageClass(client *kubernetes.Clientset) *storagev1.StorageClass
- func GetDefaultVirtStorageClass(client *kubernetes.Clientset) *storagev1.StorageClass
- func GetSchedulableNode(nodes *v1.NodeList) *string
- func GetServiceInNamespace(c *kubernetes.Clientset, ns, name string) (*v1.Service, error)
- func GetServiceInNamespaceOrDie(c *kubernetes.Clientset, ns, name string) *v1.Service
- func GetServiceNodePortByName(svc *v1.Service, name string) (int, error)
- func GetServicePortByName(svc *v1.Service, name string) (int, error)
- func GetServicesInNamespaceByLabel(c *kubernetes.Clientset, ns, labelSelector string) (*v1.ServiceList, error)
- func GetStorageProfileSpec(clientSet *cdiclientset.Clientset, storageClassName string) (*cdiv1.StorageProfileSpec, error)
- func GetTestNamespaceList(client *kubernetes.Clientset, nsPrefix string) (*corev1.NamespaceList, error)
- func HasInsecureRegistry(c client.Client, registryURL string) (bool, error)
- func IsDefaultSCNoProvisioner() bool
- func IsExpectedNode(clientSet *kubernetes.Clientset, nodeName, podName, namespace string, ...) error
- func IsHostpathProvisioner() bool
- func IsNfs() bool
- func IsOpenshift(client kubernetes.Interface) bool
- func IsStaticNfs() bool
- func IsStaticNfsWithInternalClusterServer() bool
- func ModifyDataVolumeWithImportToBlockPV(dataVolume *cdiv1.DataVolume, storageClassName string) *cdiv1.DataVolume
- func NewBlockPVCDefinition(pvcName string, size string, annotations, labels map[string]string, ...) *k8sv1.PersistentVolumeClaim
- func NewCloningDataVolume(dataVolumeName, size string, sourcePvc *k8sv1.PersistentVolumeClaim) *cdiv1.DataVolume
- func NewDataImportCron(name, size, schedule, dataSource string, importsToKeep int32, ...) *cdiv1.DataImportCron
- func NewDataImportCronWithStorageSpec(name, size, schedule, dataSource string, importsToKeep int32, ...) *cdiv1.DataImportCron
- func NewDataVolumeCloneToBlockPV(dataVolumeName string, size string, ...) *cdiv1.DataVolume
- func NewDataVolumeCloneToBlockPVStorageAPI(dataVolumeName string, size string, ...) *cdiv1.DataVolume
- func NewDataVolumeForBlankRawImage(dataVolumeName, size string) *cdiv1.DataVolume
- func NewDataVolumeForBlankRawImageBlock(dataVolumeName, size string, storageClassName string) *cdiv1.DataVolume
- func NewDataVolumeForCloningWithEmptySize(dataVolumeName, namespace, pvcName string, storageClassName *string, ...) *cdiv1.DataVolume
- func NewDataVolumeForImageCloning(dataVolumeName, size, namespace, pvcName string, storageClassName *string, ...) *cdiv1.DataVolume
- func NewDataVolumeForImageCloningAndStorageSpec(dataVolumeName, size, namespace, pvcName string, storageClassName *string, ...) *cdiv1.DataVolume
- func NewDataVolumeForSnapshotCloning(dataVolumeName, size, namespace, snapshot string, storageClassName *string, ...) *cdiv1.DataVolume
- func NewDataVolumeForSnapshotCloningAndStorageSpec(dataVolumeName, size, namespace, snapshot string, storageClassName *string, ...) *cdiv1.DataVolume
- func NewDataVolumeForUpload(dataVolumeName string, size string) *cdiv1.DataVolume
- func NewDataVolumeForUploadWithStorageAPI(dataVolumeName string, size string) *cdiv1.DataVolume
- func NewDataVolumeWithArchiveContent(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
- func NewDataVolumeWithArchiveContentStorage(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
- func NewDataVolumeWithExternalPopulation(dataVolumeName, size, storageClassName string, ...) *cdiv1.DataVolume
- func NewDataVolumeWithExternalPopulationAndStorageSpec(dataVolumeName, size, storageClassName string, ...) *cdiv1.DataVolume
- func NewDataVolumeWithGCSImport(dataVolumeName string, size string, gcsURL string) *cdiv1.DataVolume
- func NewDataVolumeWithHTTPImport(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
- func NewDataVolumeWithHTTPImportAndStorageSpec(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
- func NewDataVolumeWithHTTPImportToBlockPV(dataVolumeName string, size string, httpURL, storageClassName string) *cdiv1.DataVolume
- func NewDataVolumeWithImageioImport(dataVolumeName string, size string, httpURL string, secret string, ...) *cdiv1.DataVolume
- func NewDataVolumeWithImageioWarmImport(dataVolumeName string, size string, httpURL string, secret string, ...) *cdiv1.DataVolume
- func NewDataVolumeWithRegistryImport(dataVolumeName string, size string, registryURL string) *cdiv1.DataVolume
- func NewDataVolumeWithSourceRef(dataVolumeName string, size, sourceRefNamespace, sourceRefName string) *cdiv1.DataVolume
- func NewDataVolumeWithSourceRefAndStorageAPI(dataVolumeName string, size *string, sourceRefNamespace, sourceRefName string) *cdiv1.DataVolume
- func NewDataVolumeWithVddkImport(dataVolumeName string, size string, backingFile string, secretRef string, ...) *cdiv1.DataVolume
- func NewDataVolumeWithVddkWarmImport(dataVolumeName string, size string, backingFile string, secretRef string, ...) *cdiv1.DataVolume
- func NewPVCDefinition(pvcName string, size string, annotations, labels map[string]string) *k8sv1.PersistentVolumeClaim
- func NewPVCDefinitionWithSelector(pvcName, size, storageClassName string, selector map[string]string, ...) *k8sv1.PersistentVolumeClaim
- func NewPVDefinition(pvName, size, storageClassName, node string, labels map[string]string) *k8sv1.PersistentVolume
- func NewPvcDataSource(dataSourceName, dataSourceNamespace, pvcName, pvcNamespace string) *cdiv1.DataSource
- func NewSecretDefinition(labels, stringData map[string]string, data map[string][]byte, ...) *v1.Secret
- func NewSnapshotDataSource(dataSourceName, dataSourceNamespace, snapshotName, snapshotNamespace string) *cdiv1.DataSource
- func NewVolumeImportSourceWithURLImport(name, url string) *cdiv1.VolumeImportSource
- func NewVolumeImportSourceWithVddkWarmImport(name, pvcName, backingFile, secretRef, thumbprint, httpURL, uuid, ... string, ...) *cdiv1.VolumeImportSource
- func NewVolumeSnapshot(name, namespace, sourcePvcName string, snapshotClassName *string) *snapshotv1.VolumeSnapshot
- func PersistentVolumeClaimFromDataVolume(datavolume *cdiv1.DataVolume) *k8sv1.PersistentVolumeClaim
- func PodGetNode(clientSet *kubernetes.Clientset, podName, namespace string) (string, error)
- func RemoveInsecureRegistry(c client.Client, registryURL string) error
- func RequestUploadToken(clientSet *cdiClientset.Clientset, pvc *k8sv1.PersistentVolumeClaim) (string, error)
- func UpdateCDIConfig(c client.Client, updateFunc func(*cdiv1.CDIConfigSpec)) error
- func UpdateCDIConfigWithOptions(c client.Client, opts metav1.UpdateOptions, ...) error
- func UpdateStorageProfile(client client.Client, name string, spec cdiv1.StorageProfileSpec) error
- func UploadArchivePVCDefinition() *k8sv1.PersistentVolumeClaim
- func UploadBlockPVCDefinition(storageClass string) *k8sv1.PersistentVolumeClaim
- func UploadPVCDefinition() *k8sv1.PersistentVolumeClaim
- func UploadPodName(pvc *k8sv1.PersistentVolumeClaim) string
- func UploadPopulationBlockPVCDefinition(storageClassName string) *k8sv1.PersistentVolumeClaim
- func UploadPopulationPVCDefinition() *k8sv1.PersistentVolumeClaim
- func UploadPopulatorCR(namespace, contentType string) *unstructured.Unstructured
- func WaitForCDICrCloneStrategy(clientSet *cdiClientset.Clientset, cloneStrategy cdiv1.CDICloneStrategy) error
- func WaitForCDICrCloneStrategyNil(clientSet *cdiClientset.Clientset) error
- func WaitForConditions(ci ClientsIface, dataVolumeName, namespace string, ...)
- func WaitForDataVolumeGC(ci ClientsIface, namespace string, pvcName string, ttl int32, ...) error
- func WaitForDataVolumePhase(ci ClientsIface, namespace string, phase cdiv1.DataVolumePhase, ...) error
- func WaitForDataVolumePhaseWithTimeout(ci ClientsIface, namespace string, phase cdiv1.DataVolumePhase, ...) error
- func WaitForDeploymentReplicasReady(c *kubernetes.Clientset, namespace, name string) error
- func WaitForDeploymentReplicasReadyOrDie(c *kubernetes.Clientset, namespace, name string)
- func WaitForPVC(clientSet *kubernetes.Clientset, namespace, name string) (*k8sv1.PersistentVolumeClaim, error)
- func WaitForPVCAnnotation(clientSet *kubernetes.Clientset, namespace string, ...) (string, bool, error)
- func WaitForPVCAnnotationWithValue(clientSet *kubernetes.Clientset, namespace string, ...) (bool, error)
- func WaitForPersistentVolumeClaimPhase(clientSet *kubernetes.Clientset, namespace string, ...) error
- func WaitPVCDeleted(clientSet *kubernetes.Clientset, pvcName, namespace string, ...) (bool, error)
- func WaitPVCDeletedByUID(clientSet *kubernetes.Clientset, pvcSpec *k8sv1.PersistentVolumeClaim, ...) (bool, error)
- func WaitPVCPodStatusFailed(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
- func WaitPVCPodStatusReady(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
- func WaitPVCPodStatusRunning(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
- func WaitPVCPodStatusSucceeded(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
- func WaitPVCUploadPodStatusRunning(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
- func WaitPodDeleted(clientSet *kubernetes.Clientset, podName, namespace string, ...) (bool, error)
- func WaitSnapshotReady(c client.Client, snapshot *snapshotv1.VolumeSnapshot) *snapshotv1.VolumeSnapshot
- func WaitTimeoutForPVDeleted(clientSet *kubernetes.Clientset, pv *k8sv1.PersistentVolume, ...) error
- func WaitTimeoutForPVReady(clientSet *kubernetes.Clientset, pvName string, timeout time.Duration) error
- func WaitTimeoutForPVStatus(clientSet *kubernetes.Clientset, pvName string, ...) error
- func WaitTimeoutForPodCondition(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodFailed(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodReady(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodReadyPollPeriod(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodStatus(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- func WaitTimeoutForPodSucceeded(clientSet *kubernetes.Clientset, podName, namespace string, ...) error
- type ClientsIface
Constants ¶
const ( //RegistryHostName provides a deploymnet and service name for registry RegistryHostName = "cdi-docker-registry-host" // FileHostName provides a deployment and service name for tests FileHostName = "cdi-file-host" // FileHostS3Bucket provides an S3 bucket name for tests (e.g. http://<serviceIP:port>/FileHostS3Bucket/image) FileHostS3Bucket = "images" // AccessKeyValue provides a username to use for http and S3 (see hack/build/docker/cdi-func-test-file-host-http/htpasswd) AccessKeyValue = "admin" // SecretKeyValue provides a password to use for http and S3 (see hack/build/docker/cdi-func-test-file-host-http/htpasswd) SecretKeyValue = "password" // HttpAuthPort provides a cdi-file-host service auth port for tests HTTPAuthPort = 81 // HttpNoAuthPort provides a cdi-file-host service no-auth port for tests, requires AccessKeyValue and SecretKeyValue HTTPNoAuthPort = 80 // HTTPRateLimitPort provides a cdi-file-host service rate limit port for tests, speed is limited to 25k/s to allow for testing slow connection behavior. No auth. HTTPRateLimitPort = 82 // S3Port provides a cdi-file-host service S3 port, requires AccessKey and SecretKeyValue S3Port = 9000 // HTTPSPort is the https port of cdi-file-host HTTPSNoAuthPort = 443 // RegistryCertConfigMap is the ConfigMap where the cert for the docker registry is stored RegistryCertConfigMap = "cdi-docker-registry-host-certs" // FileHostCertConfigMap is the ConfigMap where the cert fir the file host is stored FileHostCertConfigMap = "cdi-file-host-certs" // ImageIOCertConfigMap is the ConfigMap where the cert fir the file host is stored ImageIOCertConfigMap = "imageio-certs" )
cdi-file-host pod/service relative values
const ( // TinyCoreIsoURL provides a test url for the tineyCore iso image TinyCoreIsoURL = "http://cdi-file-host.%s/tinyCore.iso" // TinyCoreQcow2URL provides a test url for the tineyCore qcow2 image TinyCoreQcow2URL = "http://cdi-file-host.%s/tinyCore.qcow2" //TinyCoreIsoRegistryURL provides a test url for the tinycore.qcow2 image wrapped in docker container TinyCoreIsoRegistryURL = "docker://cdi-docker-registry-host.%s/tinycoreqcow2" //TinyCoreIsoRegistryProxyURL provides a test url for the tinycore.qcow2 image wrapped in docker container available through rate-limiting proxy TinyCoreIsoRegistryProxyURL = "docker://cdi-file-host.%s:83/tinycoreqcow2" // TinyCoreIsoAuthURL provides a tinyCore ISO from a URL that requires basic authentication TinyCoreIsoAuthURL = "http://cdi-file-host.%s:81/tinyCore.iso" // HTTPSTinyCoreIsoURL provides a test (https) url for the tineyCore iso image HTTPSTinyCoreIsoURL = "https://cdi-file-host.%s/tinyCore.iso" // HTTPSTinyCoreQcow2URL provides a test (https) url for the tineyCore qcow2 image HTTPSTinyCoreQcow2URL = "https://cdi-file-host.%s/tinyCore.qcow2" // HTTPSTinyCoreZstURL provides a test (https) url for the tineyCore zst image HTTPSTinyCoreZstURL = "https://cdi-file-host.%s/tinyCore.iso.zst" // TinyCoreQcow2URLRateLimit provides a test url for the tineyCore qcow2 image via rate-limiting proxy TinyCoreQcow2URLRateLimit = "http://cdi-file-host.%s:82/tinyCore.qcow2" // TinyCoreQcow2GzURLRateLimit provides a test url for the tineyCore qcow2.gz image via rate-limiting proxy TinyCoreQcow2GzURLRateLimit = "http://cdi-file-host.%s:82/tinyCore.qcow2.gz" // HTTPSTinyCoreVmdkURL provides a test url for the tineyCore qcow2 image HTTPSTinyCoreVmdkURL = "https://cdi-file-host.%s/tinyCore.vmdk" // HTTPSTinyCoreVdiURL provides a test url for the tineyCore qcow2 image HTTPSTinyCoreVdiURL = "https://cdi-file-host.%s/tinyCore.vdi" // HTTPSTinyCoreVhdURL provides a test url for the tineyCore qcow2 image HTTPSTinyCoreVhdURL = "https://cdi-file-host.%s/tinyCore.vhd" // HTTPSTinyCoreVhdxURL provides a test url for the tineyCore qcow2 image HTTPSTinyCoreVhdxURL = "https://cdi-file-host.%s/tinyCore.vhdx" // InvalidQcowImagesURL provides a test url for invalid qcow images InvalidQcowImagesURL = "http://cdi-file-host.%s/invalid_qcow_images/" // LargeVirtualDiskQcow provides a test url for a cirros image with a large virtual size, in qcow2 format LargeVirtualDiskQcow = "http://cdi-file-host.%s/cirros-large-virtual-size.qcow2" // LargeVirtualDiskXz provides a test url for a cirros image with a large virtual size, in RAW format, XZ-compressed LargeVirtualDiskXz = "http://cdi-file-host.%s/cirros-large-virtual-size.raw.xz" // LargePhysicalDiskQcow provides a test url for a cirros image with a large physical size, in qcow2 format LargePhysicalDiskQcow = "http://cdi-file-host.%s/cirros-large-physical-size.qcow2" // LargePhysicalDiskXz provides a test url for a cirros image with a large physical size, in RAW format, XZ-compressed LargePhysicalDiskXz = "http://cdi-file-host.%s/cirros-large-physical-size.raw.xz" // TarArchiveURL provides a test url for a tar archive file TarArchiveURL = "http://cdi-file-host.%s/archive.tar" // CirrosURL provides the standard cirros image qcow image CirrosURL = "http://cdi-file-host.%s/cirros-qcow2.img" // CirrosGCSQCOWURL provides the standard cirros image qcow image for GCS CirrosGCSQCOWURL = "http://cdi-file-host.%s/gcs-bucket/cirros-qcow2.img" // CirrosGCSRAWURL provides the standard cirros image raw image for GCS CirrosGCSRAWURL = "http://cdi-file-host.%s/gcs-bucket/cirros.raw" // ImageioURL provides URL of oVirt engine hosting imageio ImageioURL = "https://imageio.%s:12346/ovirt-engine/api" // ImageioRootURL provides the base path to fakeovirt, for inventory modifications ImageioRootURL = "https://imageio.%s:12346" // ImageioImageURL provides the base path to imageiotest, for test images ImageioImageURL = "https://imageio.%s:12345" // VcenterURL provides URL of vCenter/ESX simulator VcenterURL = "https://vcenter.%s:8989/sdk" // TrustedRegistryURL provides the base path to trusted registry test url for the tinycore.iso image wrapped in docker container TrustedRegistryURL = "docker://%s/cdi-func-test-tinycore" // TrustedRegistryURLQcow2 provides the base path to trusted registry test url for the cirros qcow2 image wrapped in docker container TrustedRegistryURLQcow2 = "docker://%s/cdi-func-test-cirros-qcow2" // TrustedRegistryIS provides the base path to trusted registry test fake imagestream for the tinycore.iso image wrapped in docker container TrustedRegistryIS = "%s/cdi-func-test-tinycore" // MD5PrefixSize is the number of bytes used by the MD5 constants below MD5PrefixSize = int64(100000) // TinyCoreMD5 is the MD5 hash of first 100k bytes of tinyCore image TinyCoreMD5 = "3710416a680523c7d07538cb1026c60c" // CirrosMD5 is the MD5 hash of first 100k bytes of cirros image CirrosMD5 = "91150be031835ccfac458744da57d4f6" // TinyCoreTarMD5 is the MD5 hash of first 100k bytes of tinyCore tar image TinyCoreTarMD5 = "aec1a39d753b4b7cc81ee02bc625a342" // ImageioMD5 is the MD5 hash of first 100k bytes of imageio image ImageioMD5 = "91150be031835ccfac458744da57d4f6" // VcenterMD5 is the MD5 hash of first 100k bytes of Vcenter image VcenterMD5 = "91150be031835ccfac458744da57d4f6" // BlankMD5 is the MD5 hash of first 100k bytes of blank image BlankMD5 = "0019d23bef56a136a1891211d7007f6f" )
const ( // PodWaitForTime is the time to wait for Pod operations to complete PodWaitForTime = defaultPollPeriod // PodWaitForTimeFast is the fast time to wait for Pod operations to complete (30 sec) PodWaitForTimeFast = defaultPollPeriodFast // PodWaitIntervalFast is the fast polling interval (250ms) PodWaitIntervalFast = 250 * time.Millisecond //VerifierPodName is the name of the verifier pod. VerifierPodName = "verifier" )
const ( // DefaultPvcMountPath is the default mount path used DefaultPvcMountPath = "/dev/pvc" // DefaultImagePath is the default destination for images created by CDI DefaultImagePath = DefaultPvcMountPath + "/disk.img" )
const ( // TinyCoreFile is the file name of tine core TinyCoreFile = "/tinyCore.iso" // CirrosQCow2File is the file name of cirros qcow CirrosQCow2File = "/cirros-qcow2.img" // UploadFile is the file to upload UploadFile = imagesPath + TinyCoreFile // FsOverheadFile a file with some arbitrary size to check the fsOverhead validation logic FsOverheadFile = imagesPath + "/fs-overhead.qcow2" // UploadFileLargeVirtualDiskQcow is the file to upload (QCOW2) UploadFileLargeVirtualDiskQcow = "./images/cirros-large-virtual-size.qcow2" // UploadFileLargeVirtualDiskXz is the file to upload (XZ-compressed RAW file) UploadFileLargeVirtualDiskXz = "./images/cirros-large-virtual-size.raw.xz" // UploadFileLargePhysicalDiskQcow is the file to upload (QCOW2) UploadFileLargePhysicalDiskQcow = "./images/cirros-large-physical-size.qcow2" // UploadFileLargePhysicalDiskXz is the file to upload (XZ-compressed RAW file) UploadFileLargePhysicalDiskXz = "./images/cirros-large-physical-size.raw.xz" // UploadCirrosFile is the file to upload (QCOW2) UploadCirrosFile = imagesPath + CirrosQCow2File // UploadFileSize is the size of UploadFile UploadFileSize = 18874368 // UploadFileMD5 is the expected MD5 of the uploaded file UploadFileMD5 = "2a7a52285c846314d1dbd79e9818270d" // UploadFileMD5100kbytes is the size of the image after being extended UploadFileMD5100kbytes = "3710416a680523c7d07538cb1026c60c" )
Variables ¶
var ( // DefaultStorageClass the default storage class used in tests DefaultStorageClass *storagev1.StorageClass // DefaultStorageClassCsiDriver the default storage class CSI driver if it exists. DefaultStorageClassCsiDriver *storagev1.CSIDriver // NfsService is the service in the cdi namespace that will be created if KUBEVIRT_STORAGE=nfs NfsService *corev1.Service // DefaultStorageCSIRespectsFsGroup is true if the default storage class is CSI and respects fsGroup, false other wise. DefaultStorageCSIRespectsFsGroup bool )
Functions ¶
func AddInsecureRegistry ¶ added in v1.33.1
AddInsecureRegistry adds the registry to CDIConfig InsecureRegistries to mark it as allowed to be insecure
func ArchiveFiles ¶ added in v1.4.0
ArchiveFiles creates a tar file that archives the given source files.
func CacheTestsData ¶ added in v1.10.2
func CacheTestsData(client *kubernetes.Clientset, cdiNs string)
CacheTestsData fetch and cache data required for tests
func CleanupDvPvc ¶ added in v1.56.0
func CleanupDvPvc(k8sClient *kubernetes.Clientset, cdiClient *cdiclientset.Clientset, namespace, name string)
CleanupDvPvc deletes DV or PVC if DV was GCed, and waits for PVC to be gone
func CleanupDvPvcNoWait ¶ added in v1.57.0
func CleanupDvPvcNoWait(k8sClient *kubernetes.Clientset, cdiClient *cdiclientset.Clientset, namespace, name string)
CleanupDvPvcNoWait deletes DV or PVC if DV was GCed
func ConfigureCloneStrategy ¶ added in v1.38.0
func ConfigureCloneStrategy(client client.Client, clientSet *cdiclientset.Clientset, storageClassName string, spec *cdiv1.StorageProfileSpec, cloneStrategy cdiv1.CDICloneStrategy) error
ConfigureCloneStrategy updates the storageProfile found by name, with given CDICloneStrategy.
func CopyConfigMap ¶ added in v1.5.4
func CopyConfigMap(client kubernetes.Interface, srcNamespace, srcName, destNamespace, destName, destKey string) (string, error)
CopyConfigMap copies a ConfigMap, set destKey if you want to override the default tls.crt with a different key name
func CopyFileHostCertConfigMap ¶ added in v1.7.0
func CopyFileHostCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
CopyFileHostCertConfigMap copies the test file host configmap, it assumes the File host is in the CDI namespace
func CopyImageIOCertConfigMap ¶ added in v1.15.0
func CopyImageIOCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
CopyImageIOCertConfigMap copies the test imageio configmap, it assumes the imageio server is in the CDI namespace
func CopyRegistryCertConfigMap ¶ added in v1.5.4
func CopyRegistryCertConfigMap(client kubernetes.Interface, destNamespace, cdiNamespace string) (string, error)
CopyRegistryCertConfigMap copies the test registry configmap, it assumes the Registry host is in the CDI namespace
func CopyRegistryCertConfigMapDestName ¶ added in v1.20.0
func CopyRegistryCertConfigMapDestName(client kubernetes.Interface, destNamespace, cdiNamespace, destName string) (string, error)
CopyRegistryCertConfigMapDestName copies the test registry configmap, it assumes the Registry host is in the CDI namespace
func CreateCertConfigMapWeirdFilename ¶ added in v1.34.1
func CreateCertConfigMapWeirdFilename(client kubernetes.Interface, destNamespace, srcNamespace string) (string, error)
CreateCertConfigMapWeirdFilename copies a configmap with a different key value
func CreateCertForTestService ¶ added in v1.7.0
func CreateCertForTestService(namespace, serviceName, configMapName, certDir, certFileName, keyFileName string) error
CreateCertForTestService creates a TLS key/cert for a service, writes them to files and creates a config map containing the cert
func CreateDataVolumeFromDefinition ¶
func CreateDataVolumeFromDefinition(clientSet *cdiclientset.Clientset, namespace string, def *cdiv1.DataVolume) (*cdiv1.DataVolume, error)
CreateDataVolumeFromDefinition is used by tests to create a testable Data Volume
func CreatePVCFromDefinition ¶
func CreatePVCFromDefinition(clientSet *kubernetes.Clientset, namespace string, def *k8sv1.PersistentVolumeClaim) (*k8sv1.PersistentVolumeClaim, error)
CreatePVCFromDefinition creates a PVC in the passed in namespace from the passed in PersistentVolumeClaim definition. An example of creating a PVC without annotations looks like this: CreatePVCFromDefinition(client, namespace, NewPVCDefinition(name, size, nil, nil))
func CreatePVFromDefinition ¶ added in v1.5.0
func CreatePVFromDefinition(clientSet *kubernetes.Clientset, def *k8sv1.PersistentVolume) (*k8sv1.PersistentVolume, error)
CreatePVFromDefinition creates a PV from the passed in PersistentVolume definition. An example of creating a PVC without annotations looks like this: CreatePVCFromDefinition(client, namespace, NewPVCDefinition(name, size, nil, nil))
func CreatePod ¶
func CreatePod(clientSet *kubernetes.Clientset, namespace string, podDef *k8sv1.Pod) (*k8sv1.Pod, error)
CreatePod calls the Kubernetes API to create a Pod
func CreateSecretFromDefinition ¶
CreateSecretFromDefinition creates and returns a pointer ot a v1.Secret using a provided v1.Secret
func DeleteConfigMap ¶ added in v1.43.2
func DeleteConfigMap(client kubernetes.Interface, namespace, name string) error
DeleteConfigMap deletes a ConfigMap
func DeleteDataVolume ¶
func DeleteDataVolume(clientSet *cdiclientset.Clientset, namespace, name string) error
DeleteDataVolume deletes the DataVolume with the given name
func DeletePV ¶ added in v1.5.0
func DeletePV(clientSet *kubernetes.Clientset, pv *k8sv1.PersistentVolume) error
DeletePV deletes the passed in PV
func DeletePVC ¶
func DeletePVC(clientSet *kubernetes.Clientset, namespace, pvcName string) error
DeletePVC deletes the passed in PVC
func DeletePodByName ¶ added in v1.19.0
func DeletePodByName(clientSet *kubernetes.Clientset, podName, namespace string, gracePeriod *int64) error
DeletePodByName deletes the pod based on the passed in name from the passed in Namespace
func DeletePodNoGrace ¶ added in v1.26.0
DeletePodNoGrace deletes the passed in Pod from the passed in Namespace
func DeleteSecret ¶ added in v1.4.0
DeleteSecret ...
func DeleteVerifierPod ¶ added in v1.19.0
func DeleteVerifierPod(clientSet *kubernetes.Clientset, namespace string) error
DeleteVerifierPod deletes the verifier pod
func DisableFeatureGate ¶ added in v1.21.0
DisableFeatureGate unsets specified FeatureGate in the CDIConfig
func EnableFeatureGate ¶ added in v1.21.0
EnableFeatureGate sets specified FeatureGate in the CDIConfig
func FindPVC ¶
func FindPVC(clientSet *kubernetes.Clientset, namespace, pvcName string) (*k8sv1.PersistentVolumeClaim, error)
FindPVC Finds the passed in PVC
func FindPodByPrefix ¶
func FindPodByPrefix(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
FindPodByPrefix finds the first pod which has the passed in prefix. Returns error if multiple pods with the same prefix are found.
func FindPodByPrefixOnce ¶ added in v1.36.0
func FindPodByPrefixOnce(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)
FindPodByPrefixOnce finds once (no polling) the first pod which has the passed in prefix. Returns error if multiple pods with the same prefix are found.
func FindPodBySuffix ¶ added in v1.36.0
func FindPodBySuffix(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)
FindPodBySuffix finds the first pod which has the passed in suffix. Returns error if multiple pods with the same suffix are found.
func FindPodBySuffixOnce ¶ added in v1.36.0
func FindPodBySuffixOnce(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)
FindPodBySuffixOnce finds once (no polling) the first pod which has the passed in suffix. Returns error if multiple pods with the same suffix are found.
func FormatTestData ¶
FormatTestData accepts the path of a single file (srcFile) and attempts to generate an output file in the format defined by targetFormats (e.g. ".tar", ".gz" will produce a .tar.gz formatted file). The output file is written to the directory in `tgtDir`. returns:
(string) Path of output file (error) Errors that occur during formatting
func GetCloneType ¶ added in v1.34.0
func GetCloneType(clientSet *cdiclientset.Clientset, dataVolume *cdiv1.DataVolume) string
GetCloneType returnc the CDI clone type
func GetDefaultStorageClass ¶ added in v1.42.0
func GetDefaultStorageClass(client *kubernetes.Clientset) *storagev1.StorageClass
GetDefaultStorageClass return the storage class which is marked as default in the cluster
func GetDefaultVirtStorageClass ¶ added in v1.58.1
func GetDefaultVirtStorageClass(client *kubernetes.Clientset) *storagev1.StorageClass
GetDefaultVirtStorageClass return the storage class which is marked as virt default in the cluster We don't fail if virt default storage class is not defined
func GetSchedulableNode ¶ added in v1.10.7
GetSchedulableNode return a schedulable node from a nodes list
func GetServiceInNamespace ¶
GetServiceInNamespace retries get on service `name` in namespace `ns` until timeout or IsNotFound error. Ignores api errors that may be intermittent. Returns pointer to service (nil on error) or an error (nil on success)
func GetServiceInNamespaceOrDie ¶
func GetServiceInNamespaceOrDie(c *kubernetes.Clientset, ns, name string) *v1.Service
GetServiceInNamespaceOrDie attempts to get the service in namespace `ns` by `name`. Returns pointer to service on success. Panics on error.
func GetServiceNodePortByName ¶
GetServiceNodePortByName scans a service's nodePorts for a name matching the `name` parameter and returns the associated port integer or an error if not match is found.
func GetServicePortByName ¶
GetServicePortByName scans a service's ports for names matching `name`. Returns integer port value (0 on error) and error (nil on success).
func GetServicesInNamespaceByLabel ¶
func GetServicesInNamespaceByLabel(c *kubernetes.Clientset, ns, labelSelector string) (*v1.ServiceList, error)
GetServicesInNamespaceByLabel retries get of services in namespace `ns` by `labelSelector` until timeout. Ignores api errors that may be intermittent. Returns pointer to ServiceList (nil on error) and an error (nil on success)
func GetStorageProfileSpec ¶ added in v1.38.0
func GetStorageProfileSpec(clientSet *cdiclientset.Clientset, storageClassName string) (*cdiv1.StorageProfileSpec, error)
GetStorageProfileSpec attempts to get the StorageProfile for storageClass by Name.
func GetTestNamespaceList ¶ added in v1.26.0
func GetTestNamespaceList(client *kubernetes.Clientset, nsPrefix string) (*corev1.NamespaceList, error)
GetTestNamespaceList returns a list of namespaces that have been created by the functional tests.
func HasInsecureRegistry ¶ added in v1.33.1
HasInsecureRegistry checks if registry appears in CDIConfig InsecureRegistries so it is allowed to be insecure
func IsDefaultSCNoProvisioner ¶ added in v1.57.0
func IsDefaultSCNoProvisioner() bool
IsDefaultSCNoProvisioner return true if the default storage class has no provisioner
func IsExpectedNode ¶ added in v1.5.0
func IsExpectedNode(clientSet *kubernetes.Clientset, nodeName, podName, namespace string, timeout time.Duration) error
IsExpectedNode waits to check if the specified pod is schedule on the specified node
func IsHostpathProvisioner ¶ added in v1.10.2
func IsHostpathProvisioner() bool
IsHostpathProvisioner returns true if hostpath-provisioner is the default storage class
func IsNfs ¶ added in v1.13.0
func IsNfs() bool
IsNfs returns true if any type of nfs (static/dynamic-csi) is the default storage class
func IsOpenshift ¶ added in v1.31.0
func IsOpenshift(client kubernetes.Interface) bool
IsOpenshift checks if we are on OpenShift platform
func IsStaticNfs ¶ added in v1.46.0
func IsStaticNfs() bool
IsStaticNfs returns true if the default storage class is the static nfs storage class with no provisioner
func IsStaticNfsWithInternalClusterServer ¶ added in v1.46.0
func IsStaticNfsWithInternalClusterServer() bool
IsStaticNfsWithInternalClusterServer returns true if the default storage class is the static nfs storage class with no provisioner and the NFS server is running inside the cluster (as opposed to external)
func ModifyDataVolumeWithImportToBlockPV ¶ added in v1.39.0
func ModifyDataVolumeWithImportToBlockPV(dataVolume *cdiv1.DataVolume, storageClassName string) *cdiv1.DataVolume
ModifyDataVolumeWithImportToBlockPV modifies a DataVolume struct for import to a block PV
func NewBlockPVCDefinition ¶ added in v1.8.0
func NewBlockPVCDefinition(pvcName string, size string, annotations, labels map[string]string, storageClassName string) *k8sv1.PersistentVolumeClaim
NewBlockPVCDefinition creates a PVC definition with volumeMode 'Block'
func NewCloningDataVolume ¶ added in v1.5.0
func NewCloningDataVolume(dataVolumeName, size string, sourcePvc *k8sv1.PersistentVolumeClaim) *cdiv1.DataVolume
NewCloningDataVolume initializes a DataVolume struct with PVC annotations
func NewDataImportCron ¶ added in v1.55.1
func NewDataImportCron(name, size, schedule, dataSource string, importsToKeep int32, source cdiv1.DataVolumeSourceRegistry) *cdiv1.DataImportCron
NewDataImportCron initializes a DataImportCron struct
func NewDataImportCronWithStorageSpec ¶ added in v1.57.0
func NewDataImportCronWithStorageSpec(name, size, schedule, dataSource string, importsToKeep int32, source cdiv1.DataVolumeSourceRegistry) *cdiv1.DataImportCron
NewDataImportCronWithStorageSpec initializes a DataImportCron struct with storage defaults-inferring API
func NewDataVolumeCloneToBlockPV ¶ added in v1.9.4
func NewDataVolumeCloneToBlockPV(dataVolumeName string, size string, srcNamespace, srcName, storageClassName string) *cdiv1.DataVolume
NewDataVolumeCloneToBlockPV initializes a DataVolume for block cloning
func NewDataVolumeCloneToBlockPVStorageAPI ¶ added in v1.43.3
func NewDataVolumeCloneToBlockPVStorageAPI(dataVolumeName string, size string, srcNamespace, srcName, storageClassName string) *cdiv1.DataVolume
NewDataVolumeCloneToBlockPVStorageAPI initializes a DataVolume for block cloning with Storage API
func NewDataVolumeForBlankRawImage ¶ added in v1.5.0
func NewDataVolumeForBlankRawImage(dataVolumeName, size string) *cdiv1.DataVolume
NewDataVolumeForBlankRawImage initializes a DataVolume struct for creating blank raw image
func NewDataVolumeForBlankRawImageBlock ¶ added in v1.10.5
func NewDataVolumeForBlankRawImageBlock(dataVolumeName, size string, storageClassName string) *cdiv1.DataVolume
NewDataVolumeForBlankRawImageBlock initializes a DataVolume struct for creating blank raw image for a block device
func NewDataVolumeForCloningWithEmptySize ¶ added in v1.50.0
func NewDataVolumeForCloningWithEmptySize(dataVolumeName, namespace, pvcName string, storageClassName *string, volumeMode *k8sv1.PersistentVolumeMode) *cdiv1.DataVolume
NewDataVolumeForCloningWithEmptySize initializes a DataVolume struct with empty storage size to test the size-detection mechanism when cloning
func NewDataVolumeForImageCloning ¶ added in v1.5.0
func NewDataVolumeForImageCloning(dataVolumeName, size, namespace, pvcName string, storageClassName *string, volumeMode *k8sv1.PersistentVolumeMode) *cdiv1.DataVolume
NewDataVolumeForImageCloning initializes a DataVolume struct for cloning disk image
func NewDataVolumeForImageCloningAndStorageSpec ¶ added in v1.38.1
func NewDataVolumeForImageCloningAndStorageSpec(dataVolumeName, size, namespace, pvcName string, storageClassName *string, volumeMode *k8sv1.PersistentVolumeMode) *cdiv1.DataVolume
NewDataVolumeForImageCloningAndStorageSpec initializes a DataVolume struct with spec.storage for cloning disk image
func NewDataVolumeForSnapshotCloning ¶ added in v1.56.0
func NewDataVolumeForSnapshotCloning(dataVolumeName, size, namespace, snapshot string, storageClassName *string, volumeMode *k8sv1.PersistentVolumeMode) *cdiv1.DataVolume
NewDataVolumeForSnapshotCloning initializes a DataVolume struct for cloning from a volume snapshot
func NewDataVolumeForSnapshotCloningAndStorageSpec ¶ added in v1.56.0
func NewDataVolumeForSnapshotCloningAndStorageSpec(dataVolumeName, size, namespace, snapshot string, storageClassName *string, volumeMode *k8sv1.PersistentVolumeMode) *cdiv1.DataVolume
NewDataVolumeForSnapshotCloningAndStorageSpec initializes a DataVolume struct for cloning from a volume snapshot
func NewDataVolumeForUpload ¶ added in v1.5.0
func NewDataVolumeForUpload(dataVolumeName string, size string) *cdiv1.DataVolume
NewDataVolumeForUpload initializes a DataVolume struct with Upload annotations
func NewDataVolumeForUploadWithStorageAPI ¶ added in v1.43.3
func NewDataVolumeForUploadWithStorageAPI(dataVolumeName string, size string) *cdiv1.DataVolume
NewDataVolumeForUploadWithStorageAPI initializes a DataVolume struct with Upload annotations and using the Storage API instead of the PVC API
func NewDataVolumeWithArchiveContent ¶ added in v1.10.0
func NewDataVolumeWithArchiveContent(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
NewDataVolumeWithArchiveContent initializes a DataVolume struct with 'archive' ContentType
func NewDataVolumeWithArchiveContentStorage ¶ added in v1.58.0
func NewDataVolumeWithArchiveContentStorage(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
NewDataVolumeWithArchiveContentStorage initializes a DataVolume struct with 'archive' ContentType
func NewDataVolumeWithExternalPopulation ¶ added in v1.56.0
func NewDataVolumeWithExternalPopulation(dataVolumeName, size, storageClassName string, volumeMode k8sv1.PersistentVolumeMode, dataSource *k8sv1.TypedLocalObjectReference, dataSourceRef *k8sv1.TypedObjectReference) *cdiv1.DataVolume
NewDataVolumeWithExternalPopulation initializes a DataVolume struct meant to be externally populated
func NewDataVolumeWithExternalPopulationAndStorageSpec ¶ added in v1.56.0
func NewDataVolumeWithExternalPopulationAndStorageSpec(dataVolumeName, size, storageClassName string, volumeMode k8sv1.PersistentVolumeMode, dataSource *k8sv1.TypedLocalObjectReference, dataSourceRef *k8sv1.TypedObjectReference) *cdiv1.DataVolume
NewDataVolumeWithExternalPopulationAndStorageSpec initializes a DataVolume struct meant to be externally populated (with storage spec)
func NewDataVolumeWithGCSImport ¶ added in v1.57.0
func NewDataVolumeWithGCSImport(dataVolumeName string, size string, gcsURL string) *cdiv1.DataVolume
NewDataVolumeWithGCSImport initializes a DataVolume struct with GCS HTTP annotations
func NewDataVolumeWithHTTPImport ¶ added in v1.3.0
func NewDataVolumeWithHTTPImport(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
NewDataVolumeWithHTTPImport initializes a DataVolume struct with HTTP annotations
func NewDataVolumeWithHTTPImportAndStorageSpec ¶ added in v1.34.0
func NewDataVolumeWithHTTPImportAndStorageSpec(dataVolumeName string, size string, httpURL string) *cdiv1.DataVolume
NewDataVolumeWithHTTPImportAndStorageSpec initializes a DataVolume struct with HTTP annotations
func NewDataVolumeWithHTTPImportToBlockPV ¶ added in v1.8.0
func NewDataVolumeWithHTTPImportToBlockPV(dataVolumeName string, size string, httpURL, storageClassName string) *cdiv1.DataVolume
NewDataVolumeWithHTTPImportToBlockPV initializes a DataVolume struct with HTTP annotations to import to block PV
func NewDataVolumeWithImageioImport ¶ added in v1.15.0
func NewDataVolumeWithImageioImport(dataVolumeName string, size string, httpURL string, secret string, configMap string, diskID string) *cdiv1.DataVolume
NewDataVolumeWithImageioImport initializes a DataVolume struct with Imageio annotations
func NewDataVolumeWithImageioWarmImport ¶ added in v1.39.0
func NewDataVolumeWithImageioWarmImport(dataVolumeName string, size string, httpURL string, secret string, configMap string, diskID string, checkpoints []cdiv1.DataVolumeCheckpoint, finalCheckpoint bool) *cdiv1.DataVolume
NewDataVolumeWithImageioWarmImport initializes a DataVolume struct for a multi-stage import from oVirt snapshots
func NewDataVolumeWithRegistryImport ¶ added in v1.5.0
func NewDataVolumeWithRegistryImport(dataVolumeName string, size string, registryURL string) *cdiv1.DataVolume
NewDataVolumeWithRegistryImport initializes a DataVolume struct with registry annotations
func NewDataVolumeWithSourceRef ¶ added in v1.37.0
func NewDataVolumeWithSourceRef(dataVolumeName string, size, sourceRefNamespace, sourceRefName string) *cdiv1.DataVolume
NewDataVolumeWithSourceRef initializes a DataVolume struct with DataSource SourceRef
func NewDataVolumeWithSourceRefAndStorageAPI ¶ added in v1.57.0
func NewDataVolumeWithSourceRefAndStorageAPI(dataVolumeName string, size *string, sourceRefNamespace, sourceRefName string) *cdiv1.DataVolume
NewDataVolumeWithSourceRefAndStorageAPI initializes a DataVolume struct with DataSource SourceRef and storage defaults-inferring API
func NewDataVolumeWithVddkImport ¶ added in v1.23.0
func NewDataVolumeWithVddkImport(dataVolumeName string, size string, backingFile string, secretRef string, thumbprint string, httpURL string, uuid string) *cdiv1.DataVolume
NewDataVolumeWithVddkImport initializes a DataVolume struct for importing disks from vCenter/ESX
func NewDataVolumeWithVddkWarmImport ¶ added in v1.28.0
func NewDataVolumeWithVddkWarmImport(dataVolumeName string, size string, backingFile string, secretRef string, thumbprint string, httpURL string, uuid string, currentCheckpoint string, previousCheckpoint string, finalCheckpoint bool) *cdiv1.DataVolume
NewDataVolumeWithVddkWarmImport initializes a DataVolume struct for a multi-stage import from vCenter/ESX snapshots
func NewPVCDefinition ¶
func NewPVCDefinition(pvcName string, size string, annotations, labels map[string]string) *k8sv1.PersistentVolumeClaim
NewPVCDefinition creates a PVC definition using the passed in name and requested size. You can use the following annotation keys to request an import or clone. The values are defined in the controller package AnnEndpoint AnnSecret AnnCloneRequest You can also pass in any label you want.
func NewPVCDefinitionWithSelector ¶ added in v1.5.0
func NewPVCDefinitionWithSelector(pvcName, size, storageClassName string, selector map[string]string, annotations, labels map[string]string) *k8sv1.PersistentVolumeClaim
NewPVCDefinitionWithSelector creates a PVC definition.
func NewPVDefinition ¶ added in v1.5.0
func NewPVDefinition(pvName, size, storageClassName, node string, labels map[string]string) *k8sv1.PersistentVolume
NewPVDefinition creates a PV definition.
func NewPvcDataSource ¶ added in v1.56.0
func NewPvcDataSource(dataSourceName, dataSourceNamespace, pvcName, pvcNamespace string) *cdiv1.DataSource
NewPvcDataSource initializes a DataSource struct with PVC source
func NewSecretDefinition ¶
func NewSecretDefinition(labels, stringData map[string]string, data map[string][]byte, ns, prefix string) *v1.Secret
NewSecretDefinition provides a function to initialize a Secret data type with the provided options
func NewSnapshotDataSource ¶ added in v1.56.0
func NewSnapshotDataSource(dataSourceName, dataSourceNamespace, snapshotName, snapshotNamespace string) *cdiv1.DataSource
NewSnapshotDataSource initializes a DataSource struct with volumesnapshot source
func NewVolumeImportSourceWithURLImport ¶ added in v1.60.0
func NewVolumeImportSourceWithURLImport(name, url string) *cdiv1.VolumeImportSource
NewVolumeImportSourceWithUrlImport initializes a VolumeImportSource for a HTTP import from a given URL
func NewVolumeImportSourceWithVddkWarmImport ¶ added in v1.58.0
func NewVolumeImportSourceWithVddkWarmImport(name, pvcName, backingFile, secretRef, thumbprint, httpURL, uuid, currentCheckpoint, previousCheckpoint string, finalCheckpoint bool) *cdiv1.VolumeImportSource
NewVolumeImportSourceWithVddkWarmImport initializes a VolumeImportSource for a multi-stage import from vCenter/ESX snapshots
func NewVolumeSnapshot ¶ added in v1.57.0
func NewVolumeSnapshot(name, namespace, sourcePvcName string, snapshotClassName *string) *snapshotv1.VolumeSnapshot
NewVolumeSnapshot initializes a VolumeSnapshot struct
func PersistentVolumeClaimFromDataVolume ¶ added in v1.10.2
func PersistentVolumeClaimFromDataVolume(datavolume *cdiv1.DataVolume) *k8sv1.PersistentVolumeClaim
PersistentVolumeClaimFromDataVolume creates a PersistentVolumeClaim definition so we can use PersistentVolumeClaim for various operations.
func PodGetNode ¶
func PodGetNode(clientSet *kubernetes.Clientset, podName, namespace string) (string, error)
PodGetNode returns the node on which a given pod is executing
func RemoveInsecureRegistry ¶ added in v1.33.1
RemoveInsecureRegistry removed the registry from CDIConfig InsecureRegistries so it is not allowed to be insecure
func RequestUploadToken ¶
func RequestUploadToken(clientSet *cdiClientset.Clientset, pvc *k8sv1.PersistentVolumeClaim) (string, error)
RequestUploadToken sends an upload token request to the server
func UpdateCDIConfig ¶ added in v1.26.0
func UpdateCDIConfig(c client.Client, updateFunc func(*cdiv1.CDIConfigSpec)) error
UpdateCDIConfig updates CDIConfig
func UpdateCDIConfigWithOptions ¶ added in v1.26.0
func UpdateCDIConfigWithOptions(c client.Client, opts metav1.UpdateOptions, updateFunc func(*cdiv1.CDIConfigSpec)) error
UpdateCDIConfigWithOptions updates CDIConfig with specific UpdateOptions
func UpdateStorageProfile ¶ added in v1.38.0
UpdateStorageProfile updates the storageProfile found by name, with given StorageProfileSpec.
func UploadArchivePVCDefinition ¶ added in v1.41.0
func UploadArchivePVCDefinition() *k8sv1.PersistentVolumeClaim
UploadArchivePVCDefinition creates a PVC with the upload target annotation and archive context-type
func UploadBlockPVCDefinition ¶ added in v1.9.0
func UploadBlockPVCDefinition(storageClass string) *k8sv1.PersistentVolumeClaim
UploadBlockPVCDefinition creates a PVC with the upload target annotation for block PV
func UploadPVCDefinition ¶
func UploadPVCDefinition() *k8sv1.PersistentVolumeClaim
UploadPVCDefinition creates a PVC with the upload target annotation
func UploadPodName ¶
func UploadPodName(pvc *k8sv1.PersistentVolumeClaim) string
UploadPodName returns the name of the upload server pod associated with a PVC
func UploadPopulationBlockPVCDefinition ¶ added in v1.57.0
func UploadPopulationBlockPVCDefinition(storageClassName string) *k8sv1.PersistentVolumeClaim
UploadPopulationBlockPVCDefinition creates a PVC with upload datasourceref and volumeMode 'Block'
func UploadPopulationPVCDefinition ¶ added in v1.57.0
func UploadPopulationPVCDefinition() *k8sv1.PersistentVolumeClaim
UploadPopulationPVCDefinition creates a PVC with upload datasourceref
func UploadPopulatorCR ¶ added in v1.57.0
func UploadPopulatorCR(namespace, contentType string) *unstructured.Unstructured
UploadPopulatorCR creates an upload source CR
func WaitForCDICrCloneStrategy ¶ added in v1.34.0
func WaitForCDICrCloneStrategy(clientSet *cdiClientset.Clientset, cloneStrategy cdiv1.CDICloneStrategy) error
WaitForCDICrCloneStrategy waits for a CDI CR Clone strategy
func WaitForCDICrCloneStrategyNil ¶ added in v1.34.0
func WaitForCDICrCloneStrategyNil(clientSet *cdiClientset.Clientset) error
WaitForCDICrCloneStrategyNil waits for a CDI CR strategy to be nil
func WaitForConditions ¶ added in v1.52.0
func WaitForConditions(ci ClientsIface, dataVolumeName, namespace string, timeout, pollingInterval time.Duration, expectedConditions ...*cdiv1.DataVolumeCondition)
WaitForConditions waits until the data volume conditions match the expected conditions
func WaitForDataVolumeGC ¶ added in v1.51.0
func WaitForDataVolumeGC(ci ClientsIface, namespace string, pvcName string, ttl int32, timeout time.Duration) error
WaitForDataVolumeGC waits for DataVolume garbage collected
func WaitForDataVolumePhase ¶
func WaitForDataVolumePhase(ci ClientsIface, namespace string, phase cdiv1.DataVolumePhase, dataVolumeName string) error
WaitForDataVolumePhase waits for DV to be in a specific phase (Pending, Bound, Succeeded etc.) or garbage collected if the passed in phase is Succeeded
func WaitForDataVolumePhaseWithTimeout ¶ added in v1.12.0
func WaitForDataVolumePhaseWithTimeout(ci ClientsIface, namespace string, phase cdiv1.DataVolumePhase, dataVolumeName string, timeout time.Duration) error
WaitForDataVolumePhaseWithTimeout waits with timeout for DV to be in a specific phase (Pending, Bound, Succeeded etc.) or garbage collected if the passed in phase is Succeeded
func WaitForDeploymentReplicasReady ¶
func WaitForDeploymentReplicasReady(c *kubernetes.Clientset, namespace, name string) error
WaitForDeploymentReplicasReady will wait for replicase to become ready and return an error if they do not
func WaitForDeploymentReplicasReadyOrDie ¶
func WaitForDeploymentReplicasReadyOrDie(c *kubernetes.Clientset, namespace, name string)
WaitForDeploymentReplicasReadyOrDie adds the ability to fatal out if the replicas don't become ready
func WaitForPVC ¶ added in v1.9.4
func WaitForPVC(clientSet *kubernetes.Clientset, namespace, name string) (*k8sv1.PersistentVolumeClaim, error)
WaitForPVC waits for a PVC
func WaitForPVCAnnotation ¶
func WaitForPVCAnnotation(clientSet *kubernetes.Clientset, namespace string, pvc *k8sv1.PersistentVolumeClaim, annotation string) (string, bool, error)
WaitForPVCAnnotation waits for an anotation to appear on a PVC
func WaitForPVCAnnotationWithValue ¶
func WaitForPVCAnnotationWithValue(clientSet *kubernetes.Clientset, namespace string, pvc *k8sv1.PersistentVolumeClaim, annotation, expected string) (bool, error)
WaitForPVCAnnotationWithValue waits for an annotation with a specific value on a PVC
func WaitForPersistentVolumeClaimPhase ¶
func WaitForPersistentVolumeClaimPhase(clientSet *kubernetes.Clientset, namespace string, phase k8sv1.PersistentVolumeClaimPhase, pvcName string) error
WaitForPersistentVolumeClaimPhase waits for the PVC to be in a particular phase (Pending, Bound, or Lost)
func WaitPVCDeleted ¶ added in v1.4.0
func WaitPVCDeleted(clientSet *kubernetes.Clientset, pvcName, namespace string, timeout time.Duration) (bool, error)
WaitPVCDeleted polls the specified PVC until timeout or it's not found, returns true if deleted in the specified timeout period, and any errors
func WaitPVCDeletedByUID ¶ added in v1.20.0
func WaitPVCDeletedByUID(clientSet *kubernetes.Clientset, pvcSpec *k8sv1.PersistentVolumeClaim, timeout time.Duration) (bool, error)
WaitPVCDeletedByUID polls the specified PVC until timeout or it's not found, returns true if the PVC with the same UID is deleted in the specified timeout period, and any errors
func WaitPVCPodStatusFailed ¶ added in v1.8.0
func WaitPVCPodStatusFailed(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
WaitPVCPodStatusFailed waits for the pod status annotation to be Failed
func WaitPVCPodStatusReady ¶ added in v1.11.0
func WaitPVCPodStatusReady(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
WaitPVCPodStatusReady waits for the pod ready annotation to be true
func WaitPVCPodStatusRunning ¶ added in v1.8.0
func WaitPVCPodStatusRunning(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
WaitPVCPodStatusRunning waits for the pod status annotation to be Running
func WaitPVCPodStatusSucceeded ¶ added in v1.8.0
func WaitPVCPodStatusSucceeded(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
WaitPVCPodStatusSucceeded waits for the pod status annotation to be Succeeded
func WaitPVCUploadPodStatusRunning ¶
func WaitPVCUploadPodStatusRunning(clientSet *kubernetes.Clientset, pvc *k8sv1.PersistentVolumeClaim) (bool, error)
WaitPVCUploadPodStatusRunning waits for the upload server pod status annotation to be Running
func WaitPodDeleted ¶
func WaitPodDeleted(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) (bool, error)
WaitPodDeleted waits fo a pod to no longer exist returns whether the pod is deleted along with any error
func WaitSnapshotReady ¶ added in v1.57.0
func WaitSnapshotReady(c client.Client, snapshot *snapshotv1.VolumeSnapshot) *snapshotv1.VolumeSnapshot
WaitSnapshotReady waits until the snapshot is ready to be used
func WaitTimeoutForPVDeleted ¶ added in v1.24.0
func WaitTimeoutForPVDeleted(clientSet *kubernetes.Clientset, pv *k8sv1.PersistentVolume, timeout time.Duration) error
WaitTimeoutForPVDeleted waits until the given pv no longer exists
func WaitTimeoutForPVReady ¶ added in v1.5.0
func WaitTimeoutForPVReady(clientSet *kubernetes.Clientset, pvName string, timeout time.Duration) error
WaitTimeoutForPVReady waits for the given pv to be created and ready
func WaitTimeoutForPVStatus ¶ added in v1.5.0
func WaitTimeoutForPVStatus(clientSet *kubernetes.Clientset, pvName string, status k8sv1.PersistentVolumePhase, timeout time.Duration) error
WaitTimeoutForPVStatus waits for the given pv to be created and have a expected status
func WaitTimeoutForPodCondition ¶ added in v1.38.1
func WaitTimeoutForPodCondition(clientSet *kubernetes.Clientset, podName, namespace string, conditionType k8sv1.PodConditionType, pollperiod, timeout time.Duration) error
WaitTimeoutForPodCondition waits for the given pod to be created and have an expected condition
func WaitTimeoutForPodFailed ¶ added in v1.6.0
func WaitTimeoutForPodFailed(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error
WaitTimeoutForPodFailed waits for pod to fail
func WaitTimeoutForPodReady ¶
func WaitTimeoutForPodReady(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error
WaitTimeoutForPodReady waits for the given pod to be created and ready
func WaitTimeoutForPodReadyPollPeriod ¶ added in v1.40.0
func WaitTimeoutForPodReadyPollPeriod(clientSet *kubernetes.Clientset, podName, namespace string, pollperiod, timeout time.Duration) error
WaitTimeoutForPodReadyPollPeriod waits for the given pod to be created and ready using the passed in poll period
func WaitTimeoutForPodStatus ¶
func WaitTimeoutForPodStatus(clientSet *kubernetes.Clientset, podName, namespace string, status k8sv1.PodPhase, timeout time.Duration) error
WaitTimeoutForPodStatus waits for the given pod to be created and have a expected status
func WaitTimeoutForPodSucceeded ¶
func WaitTimeoutForPodSucceeded(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error
WaitTimeoutForPodSucceeded waits for pod to succeed
Types ¶
type ClientsIface ¶ added in v1.50.0
type ClientsIface interface { K8s() *kubernetes.Clientset Cdi() *cdiClientset.Clientset }
ClientsIface is the clients interface