From 22f3dc3556958cf841b981adf59f041d80c352f5 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 7 Apr 2020 14:05:05 +0530 Subject: [PATCH] E2E: Add Ability to test with different user #919 Updated E2E to use a normal user other than admin user, who is having access to create and mount cephfs PVC and create and map rbd PVC we will use the user created by rook who is having above access. Signed-off-by: Madhu Rajanna madhupr007@gmail.com This PR adds a test case for #904 Signed-off-by: Madhu Rajanna --- e2e/utils.go | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/e2e/utils.go b/e2e/utils.go index 2439f2c02..f25ba52e7 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -33,6 +33,14 @@ import ( const ( defaultNs = "default" vaultSecretNs = "/secret/ceph-csi/" // nolint: gosec + + // rook created cephfs user + cephfsNodePluginSecretName = "rook-csi-cephfs-node" // nolint: gosec + cephfsProvisionerSecretName = "rook-csi-cephfs-provisioner" // nolint: gosec + + // rook created rbd user + rbdNodePluginSecretName = "rook-csi-rbd-node" // nolint: gosec + rbdProvisionerSecretName = "rook-csi-rbd-provisioner" // nolint: gosec ) var ( @@ -260,9 +268,14 @@ func createCephfsStorageClass(c kubernetes.Interface, f *framework.Framework, en scPath := fmt.Sprintf("%s/%s", cephfsExamplePath, "storageclass.yaml") sc := getStorageClass(scPath) sc.Parameters["fsName"] = "myfs" - sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = cephCSINamespace - sc.Parameters["csi.storage.k8s.io/controller-expand-secret-namespace"] = cephCSINamespace - sc.Parameters["csi.storage.k8s.io/node-stage-secret-namespace"] = cephCSINamespace + sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/provisioner-secret-name"] = cephfsProvisionerSecretName + + sc.Parameters["csi.storage.k8s.io/controller-expand-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/controller-expand-secret-name"] = cephfsProvisionerSecretName + + sc.Parameters["csi.storage.k8s.io/node-stage-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/node-stage-secret-name"] = cephfsNodePluginSecretName if enablePool { sc.Parameters["pool"] = "myfs-data0" @@ -284,9 +297,14 @@ func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework, param scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml") sc := getStorageClass(scPath) sc.Parameters["pool"] = "replicapool" - sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = cephCSINamespace - sc.Parameters["csi.storage.k8s.io/controller-expand-secret-namespace"] = cephCSINamespace - sc.Parameters["csi.storage.k8s.io/node-stage-secret-namespace"] = cephCSINamespace + sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/provisioner-secret-name"] = rbdProvisionerSecretName + + sc.Parameters["csi.storage.k8s.io/controller-expand-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/controller-expand-secret-name"] = rbdProvisionerSecretName + + sc.Parameters["csi.storage.k8s.io/node-stage-secret-namespace"] = rookNamespace + sc.Parameters["csi.storage.k8s.io/node-stage-secret-name"] = rbdNodePluginSecretName opt := metav1.ListOptions{ LabelSelector: "app=rook-ceph-tools",