Skip to content

Commit f1fbf81

Browse files
authored
Merge pull request kubernetes#105497 from mauriciopoppe/automated-cherry-pick-of-#105388-upstream-release-1.21
Automated cherry pick of kubernetes#105388: Copy VolumeSnapshotContent annotations in snapshottable.go
2 parents 6e21f33 + 63ed25f commit f1fbf81

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/e2e/storage/framework/snapshot_resource.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
104104
r.Vscontent, err = dc.Resource(utils.SnapshotContentGVR).Update(context.TODO(), r.Vscontent, metav1.UpdateOptions{})
105105
framework.ExpectNoError(err)
106106

107-
ginkgo.By("recording the volume handle and snapshotHandle")
107+
ginkgo.By("recording properties of the preprovisioned snapshot")
108108
snapshotHandle := r.Vscontent.Object["status"].(map[string]interface{})["snapshotHandle"].(string)
109-
framework.Logf("Recording snapshot handle: %s", snapshotHandle)
109+
framework.Logf("Recording snapshot content handle: %s", snapshotHandle)
110+
snapshotContentAnnotations := r.Vscontent.GetAnnotations()
111+
framework.Logf("Recording snapshot content annotations: %v", snapshotContentAnnotations)
110112
csiDriverName := r.Vsclass.Object["driver"].(string)
113+
framework.Logf("Recording snapshot driver: %s", csiDriverName)
111114

112115
// If the deletion policy is retain on vscontent:
113116
// when vs is deleted vscontent will not be deleted
@@ -140,7 +143,7 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
140143
snapName := getPreProvisionedSnapshotName(uuid)
141144
snapcontentName := getPreProvisionedSnapshotContentName(uuid)
142145

143-
r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName)
146+
r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapshotContentAnnotations, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName)
144147
r.Vscontent, err = dc.Resource(utils.SnapshotContentGVR).Create(context.TODO(), r.Vscontent, metav1.CreateOptions{})
145148
framework.ExpectNoError(err)
146149

@@ -299,13 +302,14 @@ func getPreProvisionedSnapshot(snapName, ns, snapshotContentName string) *unstru
299302

300303
return snapshot
301304
}
302-
func getPreProvisionedSnapshotContent(snapcontentName, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured {
305+
func getPreProvisionedSnapshotContent(snapcontentName string, snapshotContentAnnotations map[string]string, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured {
303306
snapshotContent := &unstructured.Unstructured{
304307
Object: map[string]interface{}{
305308
"kind": "VolumeSnapshotContent",
306309
"apiVersion": utils.SnapshotAPIVersion,
307310
"metadata": map[string]interface{}{
308-
"name": snapcontentName,
311+
"name": snapcontentName,
312+
"annotations": snapshotContentAnnotations,
309313
},
310314
"spec": map[string]interface{}{
311315
"source": map[string]interface{}{

0 commit comments

Comments
 (0)