e2e: Add option to set mountoptions in sc

Updated E2E code to pass mountoptions when
creating a storageclass.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 78cdf9d4db)
This commit is contained in:
Madhu Rajanna 2020-05-18 18:37:17 +05:30 committed by Madhu Rajanna
parent c2d0cc9ec1
commit c06533de6b

View File

@ -42,6 +42,8 @@ const (
// rook created rbd user // rook created rbd user
rbdNodePluginSecretName = "rook-csi-rbd-node" // nolint: gosec rbdNodePluginSecretName = "rook-csi-rbd-node" // nolint: gosec
rbdProvisionerSecretName = "rook-csi-rbd-provisioner" // nolint: gosec rbdProvisionerSecretName = "rook-csi-rbd-provisioner" // nolint: gosec
rbdmountOptions = "mountOptions"
) )
var ( var (
@ -325,6 +327,12 @@ func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework, scOpt
value := scv1.VolumeBindingWaitForFirstConsumer value := scv1.VolumeBindingWaitForFirstConsumer
sc.VolumeBindingMode = &value sc.VolumeBindingMode = &value
} }
// comma separated mount options
if opt, ok := scOptions[rbdmountOptions]; ok {
mOpt := strings.Split(opt, ",")
sc.MountOptions = append(sc.MountOptions, mOpt...)
}
_, err := c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{}) _, err := c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
Expect(err).Should(BeNil()) Expect(err).Should(BeNil())
} }