-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DataVolume): Add default instance type labels from VolumeSnapsho…
…ts and from Registry imports (#3381) * feat(DataVolume): Add default instance type labels from VolumeSnapshots de5ba85 started updating DataVolumes when reconciled, adding any labels found on PVC or DataSource sources. This commit is a follow up that starts adding labels also from VolumeSnapshots. Signed-off-by: Felix Matouschek <[email protected]> * feat(DataVolume): Add instance type labels from Registry imports de5ba85 started updating DataVolumes when reconciled, adding any labels found on PVC or DataSource sources. This commit is a follow up that starts adding labels also from Registry imported PVCs. Signed-off-by: Felix Matouschek <[email protected]> --------- Signed-off-by: Felix Matouschek <[email protected]>
- Loading branch information
Showing
5 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3412,12 +3412,52 @@ var _ = Describe("[vendor:[email protected]][level:component]DataVolume tests", | |
}, 60*time.Second, 1*time.Second).Should(BeTrue()) | ||
}, | ||
Entry("PVC", func() *cdiv1.DataVolume { | ||
By("createing a DataVolume pointing to a labelled PVC") | ||
By("creating a DataVolume pointing to a labelled PVC") | ||
dv := utils.NewDataVolumeForImageCloning("datavolume-from-pvc", "1Gi", sourceDataVolume.Namespace, sourceDataVolume.Name, nil, nil) | ||
dv, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dv) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return dv | ||
}), | ||
Entry("Snapshot", func() *cdiv1.DataVolume { | ||
if !f.IsSnapshotStorageClassAvailable() { | ||
Skip("Clone from volumesnapshot does not work without snapshot capable storage") | ||
} | ||
By("creating a labelled VolumeSnapshot") | ||
snapClass := f.GetSnapshotClass() | ||
snapshot := utils.NewVolumeSnapshot(sourceDataVolume.Name, sourceDataVolume.Namespace, sourceDataVolume.Name, &snapClass.Name) | ||
snapshot.Labels = make(map[string]string) | ||
for _, defaultInstancetypeLabel := range controller.DefaultInstanceTypeLabels { | ||
snapshot.Labels[defaultInstancetypeLabel] = "defined" | ||
} | ||
err = f.CrClient.Create(context.TODO(), snapshot) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("creating a DataVolume pointing to a labelled VolumeSnapshot") | ||
dv := utils.NewDataVolumeForSnapshotCloning("datavolume-from-snapshot", "1Gi", sourceDataVolume.Namespace, sourceDataVolume.Name, nil, nil) | ||
dv, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dv) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return dv | ||
}), | ||
Entry("Registry", func() *cdiv1.DataVolume { | ||
By("creating a DataVolume pointing to a Containerdisk") | ||
dv := utils.NewDataVolumeWithRegistryImport("datavolume-from-registry", "1Gi", tinyCoreIsoRegistryURL()) | ||
cm, err := utils.CopyRegistryCertConfigMap(f.K8sClient, f.Namespace.Name, f.CdiInstallNs) | ||
Expect(err).ToNot(HaveOccurred()) | ||
dv.Spec.Source.Registry.CertConfigMap = &cm | ||
dv, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dv) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("verifying PVC was created") | ||
pvc, err := utils.WaitForPVC(f.K8sClient, dv.Namespace, dv.Name) | ||
Expect(err).ToNot(HaveOccurred()) | ||
f.ForceBindIfWaitForFirstConsumer(pvc) | ||
|
||
By("Wait for DV to succeed") | ||
err = utils.WaitForDataVolumePhaseWithTimeout(f, dv.Namespace, cdiv1.Succeeded, dv.Name, 10*time.Minute) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
return dv | ||
}), | ||
Entry("DataSource", func() *cdiv1.DataVolume { | ||
By("createing a labelled DataSource") | ||
ds := utils.NewPvcDataSource("datasource-from-pvc", f.Namespace.Name, sourceDataVolume.Name, sourceDataVolume.Namespace) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters