-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass DV labels to PVC #2547
Pass DV labels to PVC #2547
Changes from all commits
87ac03a
8b5f210
cd50a2f
77ceb4d
dbc9997
bd33df8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1134,6 +1134,31 @@ var _ = Describe("[vendor:cnv-qe@redhat.com][level:component]DataVolume tests", | |||||
table.Entry("[test_id:8045]for clone DataVolume", createCloneDataVolume, fillCommand), | ||||||
) | ||||||
|
||||||
table.DescribeTable("Should pass all DV labels and annotations to the PVC", func(dvFunc func(string, string, string) *cdiv1.DataVolume, url string) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks great! one note, we also have:
that will not be covered by the clone test here
containerized-data-importer/tests/cloner_test.go Line 2600 in 3f19b15
Sorry for being a pain about this, it's just that when this PR merges we There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Alex. I tried to fix it, hope it's ok |
||||||
dataVolume := dvFunc("pass-all-labels-dv", "1Gi", url) | ||||||
dataVolume.Labels = map[string]string{"test-label-1": "test-label-1", "test-label-2": "test-label-2"} | ||||||
dataVolume.Annotations = map[string]string{"test-annotation-1": "test-annotation-1", "test-annotation-2": "test-annotation-2"} | ||||||
|
||||||
By(fmt.Sprintf("creating new datavolume %s", dataVolume.Name)) | ||||||
dataVolume, err := utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dataVolume) | ||||||
Expect(err).ToNot(HaveOccurred()) | ||||||
|
||||||
// verify PVC was created | ||||||
By("verifying pvc was created and is Bound") | ||||||
pvc, err := utils.WaitForPVC(f.K8sClient, dataVolume.Namespace, dataVolume.Name) | ||||||
Expect(err).ToNot(HaveOccurred()) | ||||||
|
||||||
// All labels and annotations passed | ||||||
Expect(pvc.Labels["test-label-1"]).To(Equal("test-label-1")) | ||||||
Expect(pvc.Labels["test-label-2"]).To(Equal("test-label-2")) | ||||||
Expect(pvc.Annotations["test-annotation-1"]).To(Equal("test-annotation-1")) | ||||||
Expect(pvc.Annotations["test-annotation-2"]).To(Equal("test-annotation-2")) | ||||||
}, | ||||||
table.Entry("for import DataVolume", utils.NewDataVolumeWithHTTPImport, tinyCoreIsoURL()), | ||||||
table.Entry("for upload DataVolume", createUploadDataVolume, tinyCoreIsoURL()), | ||||||
table.Entry("for clone DataVolume", createCloneDataVolume, fillCommand), | ||||||
) | ||||||
|
||||||
It("Should handle a pre populated DV", func() { | ||||||
By(fmt.Sprintf("initializing dataVolume marked as prePopulated %s", dataVolumeName)) | ||||||
dataVolume := utils.NewDataVolumeWithHTTPImport(dataVolumeName, "1Gi", cirrosURL()) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that not all flows we have are using
newPersistentVolumeClaim
One example I could find is smart clone which creates the target PVC in
containerized-data-importer/pkg/controller/datavolume/smart-clone-controller.go
Lines 370 to 374 in b875775
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alex, there is no DV in that function and the PVC is created from a VolumeSnapshot, so I don't think labels should be passed in this case. wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a way to grab/pass the associated DV to this func
containerized-data-importer/pkg/controller/datavolume/smart-clone-controller.go
Line 209 in b875775