From e988745836874718014dcc4c1c8e2db81ce6872c Mon Sep 17 00:00:00 2001 From: MICHAEL S FRUCHTMAN Date: Thu, 3 Oct 2024 10:27:44 -0700 Subject: [PATCH] Expose VSC SourceVolumeMode Add changelog and unittest Signed-off-by: Michael Fruchtman --- changelogs/unreleased/8261-msfrucht | 1 + pkg/exposer/csi_snapshot.go | 1 + pkg/exposer/csi_snapshot_test.go | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 changelogs/unreleased/8261-msfrucht diff --git a/changelogs/unreleased/8261-msfrucht b/changelogs/unreleased/8261-msfrucht new file mode 100644 index 00000000000..dce88fc5e50 --- /dev/null +++ b/changelogs/unreleased/8261-msfrucht @@ -0,0 +1 @@ +Expose VSC SourceVolumeMode \ No newline at end of file diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index 4dcc50d1291..908c2d9c68a 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -368,6 +368,7 @@ func (e *csiSnapshotExposer) createBackupVSC(ctx context.Context, ownerObject co DeletionPolicy: snapshotv1api.VolumeSnapshotContentDelete, Driver: snapshotVSC.Spec.Driver, VolumeSnapshotClassName: snapshotVSC.Spec.VolumeSnapshotClassName, + SourceVolumeMode: snapshotVSC.Spec.SourceVolumeMode, }, } diff --git a/pkg/exposer/csi_snapshot_test.go b/pkg/exposer/csi_snapshot_test.go index 0cbe65ffb49..fb02971aaf8 100644 --- a/pkg/exposer/csi_snapshot_test.go +++ b/pkg/exposer/csi_snapshot_test.go @@ -109,6 +109,7 @@ func TestExpose(t *testing.T) { } snapshotHandle := "fake-handle" + sourceVolumeMode := corev1.PersistentVolumeFilesystem vscObj := &snapshotv1api.VolumeSnapshotContent{ ObjectMeta: metav1.ObjectMeta{ Name: vscName, @@ -121,6 +122,7 @@ func TestExpose(t *testing.T) { DeletionPolicy: snapshotv1api.VolumeSnapshotContentDelete, Driver: "fake-driver", VolumeSnapshotClassName: &snapshotClass, + SourceVolumeMode: &sourceVolumeMode, }, Status: &snapshotv1api.VolumeSnapshotContentStatus{ RestoreSize: &restoreSize, @@ -522,6 +524,7 @@ func TestExpose(t *testing.T) { assert.Equal(t, expectedVSC.Spec.DeletionPolicy, vscObj.Spec.DeletionPolicy) assert.Equal(t, expectedVSC.Spec.Driver, vscObj.Spec.Driver) assert.Equal(t, *expectedVSC.Spec.VolumeSnapshotClassName, *vscObj.Spec.VolumeSnapshotClassName) + assert.Equal(t, *expectedVSC.Spec.SourceVolumeMode, *vscObj.Spec.SourceVolumeMode) if test.expectedVolumeSize != nil { assert.Equal(t, *test.expectedVolumeSize, backupPVC.Spec.Resources.Requests[corev1.ResourceStorage])