From d1cd1d0c5b9b0801219577e040e48f2422124bda Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Thu, 28 Oct 2021 15:32:59 +0530 Subject: [PATCH] rbd: add generic ephemeral volume validation This commit add e2e for ephemeral volume validation Signed-off-by: Humble Chirammal --- e2e/rbd.go | 23 +++++++++++++++++++++++ examples/rbd/pod-ephemeral.yaml | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 examples/rbd/pod-ephemeral.yaml diff --git a/e2e/rbd.go b/e2e/rbd.go index 54815c6c862..6941fe23483 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -57,6 +57,7 @@ var ( appClonePath = rbdExamplePath + "pod-restore.yaml" appSmartClonePath = rbdExamplePath + "pod-clone.yaml" appBlockSmartClonePath = rbdExamplePath + "block-pod-clone.yaml" + appEphemeralPath = rbdExamplePath + "pod-ephemeral.yaml" snapshotPath = rbdExamplePath + "snapshot.yaml" defaultCloneCount = 10 @@ -367,6 +368,28 @@ var _ = Describe("RBD", func() { } }) } + By("verify ephemeral volume support", func() { + // create application + app, err := loadApp(appEphemeralPath) + if err != nil { + e2elog.Failf("failed to load application with error %v", err) + } + app.Namespace = f.UniqueName + err = createApp(f.ClientSet, app, deployTimeout) + if err != nil { + e2elog.Failf("failed to create application with error %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 1, defaultRBDPool) + + err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) + if err != nil { + e2elog.Failf("failed to delete application with error %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 0, defaultRBDPool) + }) + // todo: may be remove the below deletion test later once the migration nodestage tests are adjusted // also to have deletion validation through the same. By("validate RBD migration+static Block PVC Deletion", func() { diff --git a/examples/rbd/pod-ephemeral.yaml b/examples/rbd/pod-ephemeral.yaml new file mode 100644 index 00000000000..457bb64b6e2 --- /dev/null +++ b/examples/rbd/pod-ephemeral.yaml @@ -0,0 +1,21 @@ +kind: Pod +apiVersion: v1 +metadata: + name: csi-rbd-demo-ephemeral-pod +spec: + containers: + - name: web-server + image: docker.io/library/nginx:latest + volumeMounts: + - mountPath: "/myspace" + name: mypvc + volumes: + - name: mypvc + ephemeral: + volumeClaimTemplate: + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: "csi-rbd-sc" + resources: + requests: + storage: 1Gi \ No newline at end of file