From 0cd878dba0960b3d07a785aa7a46594f2280aae3 Mon Sep 17 00:00:00 2001 From: Venkata Subbarao Chunduri Date: Wed, 2 Oct 2024 12:49:20 +0200 Subject: [PATCH] Fix pre-provisioned snapshots e2e test VolumeSnapshotContents object created for the pre-provisioned snapshots does not include VolumeSnapshotClass. Therefore secrets required by backing CSI driver cannot be provided via external snapshot controller. The missing secrets causes failure in the backing CSI driver. --- test/e2e/storage/framework/snapshot_resource.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/framework/snapshot_resource.go b/test/e2e/storage/framework/snapshot_resource.go index 8e07edf188074..2b72849a2af03 100644 --- a/test/e2e/storage/framework/snapshot_resource.go +++ b/test/e2e/storage/framework/snapshot_resource.go @@ -111,6 +111,7 @@ func CreateSnapshotResource(ctx context.Context, sDriver SnapshottableTestDriver framework.Logf("Recording snapshot content annotations: %v", snapshotContentAnnotations) csiDriverName := r.Vsclass.Object["driver"].(string) framework.Logf("Recording snapshot driver: %s", csiDriverName) + snapshotClassName := r.Vsclass.GetName() // If the deletion policy is retain on vscontent: // when vs is deleted vscontent will not be deleted @@ -143,7 +144,7 @@ func CreateSnapshotResource(ctx context.Context, sDriver SnapshottableTestDriver snapName := getPreProvisionedSnapshotName(uuid) snapcontentName := getPreProvisionedSnapshotContentName(uuid) - r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapshotContentAnnotations, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName) + r.Vscontent = getPreProvisionedSnapshotContent(snapcontentName, snapshotClassName, snapshotContentAnnotations, snapName, pvcNamespace, snapshotHandle, pattern.SnapshotDeletionPolicy.String(), csiDriverName) r.Vscontent, err = dc.Resource(utils.SnapshotContentGVR).Create(ctx, r.Vscontent, metav1.CreateOptions{}) framework.ExpectNoError(err) @@ -302,7 +303,7 @@ func getPreProvisionedSnapshot(snapName, ns, snapshotContentName string) *unstru return snapshot } -func getPreProvisionedSnapshotContent(snapcontentName string, snapshotContentAnnotations map[string]string, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured { +func getPreProvisionedSnapshotContent(snapcontentName, snapshotClassName string, snapshotContentAnnotations map[string]string, snapshotName, snapshotNamespace, snapshotHandle, deletionPolicy, csiDriverName string) *unstructured.Unstructured { snapshotContent := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "VolumeSnapshotContent", @@ -315,6 +316,7 @@ func getPreProvisionedSnapshotContent(snapcontentName string, snapshotContentAnn "source": map[string]interface{}{ "snapshotHandle": snapshotHandle, }, + "volumeSnapshotClassName": snapshotClassName, "volumeSnapshotRef": map[string]interface{}{ "name": snapshotName, "namespace": snapshotNamespace,