Skip to content

Commit

Permalink
cephfs: add validation for generic ephemeral volumes
Browse files Browse the repository at this point in the history
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 looks like this:

```
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
```

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
  • Loading branch information
humblec committed Oct 29, 2021
1 parent 205f69b commit b6d6278
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions e2e/cephfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -312,6 +313,28 @@ var _ = Describe("cephfs", func() {
}
})
}
By("verify generic ephemeral volume support", func() {
// snapshot beta is only supported from v1.17+
if !k8sVersionGreaterEquals(f.ClientSet, 1, 20) {
Skip("generic ephemeral volume only supported from v1.20+")
}
// 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)
}
// 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)
})

By("check static PVC", func() {
scPath := cephFSExamplePath + "secret.yaml"
Expand Down

0 comments on commit b6d6278

Please sign in to comment.