Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: add generic ephemeral volume validation #2603

Merged
merged 3 commits into from Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions e2e/cephfs.go
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,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) {
humblec marked this conversation as resolved.
Show resolved Hide resolved
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)
}
humblec marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand Down
31 changes: 31 additions & 0 deletions e2e/rbd.go
Expand Up @@ -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

Expand Down Expand Up @@ -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)
humblec marked this conversation as resolved.
Show resolved Hide resolved
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)
humblec marked this conversation as resolved.
Show resolved Hide resolved
// 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() {
Expand Down
23 changes: 23 additions & 0 deletions examples/cephfs/pod-ephemeral.yaml
@@ -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
23 changes: 23 additions & 0 deletions examples/rbd/pod-ephemeral.yaml
@@ -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
2 changes: 1 addition & 1 deletion scripts/minikube.sh
Expand Up @@ -160,7 +160,7 @@ CSI_RESIZER_VERSION=${CSI_RESIZER_VERSION:-"v1.2.0"}
CSI_NODE_DRIVER_REGISTRAR_VERSION=${CSI_NODE_DRIVER_REGISTRAR_VERSION:-"v2.2.0"}

#feature-gates for kube
K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-"ExpandCSIVolumes=true"}
K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-""}
humblec marked this conversation as resolved.
Show resolved Hide resolved

#extra-config for kube https://minikube.sigs.k8s.io/docs/reference/configuration/kubernetes/
EXTRA_CONFIG_PSP="--extra-config=apiserver.enable-admission-plugins=PodSecurityPolicy --addons=pod-security-policy"
Expand Down