mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
rbd: add generic ephemeral volume validation
This commit adds the validation of csi RBD driver to work with ephemeral volume support. With ephemeral volume support a user can specify ephemeral volumes in its pod spec and tie the lifecycle of the PVC with the POD. An example pod spec is also included in this commit. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
04e99ae2e0
commit
df0901ddd8
31
e2e/rbd.go
31
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,36 @@ var _ = Describe("RBD", func() {
|
||||
}
|
||||
})
|
||||
}
|
||||
By("verify generic ephemeral volume support", func() {
|
||||
// generic ephemeral volume support is supported from 1.21
|
||||
if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
||||
Skip("generic ephemeral volume only supported from v1.21+")
|
||||
}
|
||||
// create application
|
||||
app, err := loadApp(appEphemeralPath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load application: %v", err)
|
||||
}
|
||||
app.Namespace = f.UniqueName
|
||||
err = createApp(f.ClientSet, app, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create application: %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: %v", err)
|
||||
}
|
||||
// validate created backend rbd images
|
||||
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||
// validate images in trash
|
||||
err = waitToRemoveImagesFromTrash(f, defaultRBDPool, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to validate rbd images in pool %s trash: %v", defaultRBDPool, err)
|
||||
}
|
||||
})
|
||||
|
||||
// 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() {
|
||||
|
23
examples/rbd/pod-ephemeral.yaml
Normal file
23
examples/rbd/pod-ephemeral.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
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
|
Loading…
Reference in New Issue
Block a user