mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
cephfs: add validation for generic ephemeral volumes
This commit adds the validation of csi cephfs 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 also included in this commit. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
df0901ddd8
commit
e6949945bb
@ -279,6 +279,7 @@ var _ = Describe("cephfs", func() {
|
||||
appClonePath := cephFSExamplePath + "pod-restore.yaml"
|
||||
appSmartClonePath := cephFSExamplePath + "pod-clone.yaml"
|
||||
snapshotPath := cephFSExamplePath + "snapshot.yaml"
|
||||
appEphemeralPath := cephFSExamplePath + "pod-ephemeral.yaml"
|
||||
|
||||
By("checking provisioner deployment is running", func() {
|
||||
err := waitForDeploymentComplete(cephFSDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
|
||||
@ -312,6 +313,37 @@ var _ = Describe("cephfs", func() {
|
||||
}
|
||||
})
|
||||
}
|
||||
By("verify generic ephemeral volume support", func() {
|
||||
// generic ephemeral volume support is beta since v1.21.
|
||||
if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) {
|
||||
Skip("generic ephemeral volume only supported from v1.21+")
|
||||
}
|
||||
err := createCephfsStorageClass(f.ClientSet, f, true, nil)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create CephFS storageclass: %v", err)
|
||||
}
|
||||
// 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)
|
||||
}
|
||||
validateSubvolumeCount(f, 1, fileSystemName, subvolumegroup)
|
||||
// delete pod
|
||||
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete application: %v", err)
|
||||
}
|
||||
validateSubvolumeCount(f, 0, fileSystemName, subvolumegroup)
|
||||
err = deleteResource(cephFSExamplePath + "storageclass.yaml")
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete CephFS storageclass: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
By("check static PVC", func() {
|
||||
scPath := cephFSExamplePath + "secret.yaml"
|
||||
|
23
examples/cephfs/pod-ephemeral.yaml
Normal file
23
examples/cephfs/pod-ephemeral.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: csi-cephfs-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-cephfs-sc
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
Loading…
Reference in New Issue
Block a user