create config map for cephfs

add fs name to storageclass in e2e

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-06-07 12:22:58 +05:30
parent 864e6baea9
commit a4655f7549
3 changed files with 11 additions and 4 deletions

View File

@ -35,8 +35,9 @@ var _ = Describe("cephfs", func() {
//deploy cephfs CSI
BeforeEach(func() {
createFileSystem(f.ClientSet)
createConfigMap(f.ClientSet, f)
deployCephfsPlugin()
createCephfsStorageClass(f.ClientSet)
createCephfsStorageClass(f.ClientSet, f)
createCephfsSecret(f.ClientSet, f)
})

View File

@ -36,7 +36,7 @@ var _ = Describe("RBD", func() {
//deploy RBD CSI
BeforeEach(func() {
createRBDPool()
createRBDConfigMap(f.ClientSet, f)
createConfigMap(f.ClientSet, f)
deployRBDPlugin()
createRBDStorageClass(f.ClientSet, f)
createRBDSecret(f.ClientSet, f)

View File

@ -154,10 +154,16 @@ func getStorageClass(c kubernetes.Interface, path string) scv1.StorageClass {
return sc
}
func createCephfsStorageClass(c kubernetes.Interface) {
func createCephfsStorageClass(c kubernetes.Interface, f *framework.Framework) {
scPath := fmt.Sprintf("%s/%s", cephfsExamplePath, "storageclass.yaml")
sc := getStorageClass(c, scPath)
sc.Parameters["pool"] = "myfs-data0"
sc.Parameters["fsName"] = "myfs"
fsID := execCommandInToolBox(f, "ceph fsid")
//remove new line present in fsID
fsID = strings.Trim(fsID, "\n")
sc.Parameters["clusterID"] = fsID
_, err := c.StorageV1().StorageClasses().Create(&sc)
Expect(err).Should(BeNil())
}
@ -177,7 +183,7 @@ func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework) {
Expect(err).Should(BeNil())
}
func createRBDConfigMap(c kubernetes.Interface, f *framework.Framework) {
func createConfigMap(c kubernetes.Interface, f *framework.Framework) {
path := rbdDirPath + rbdConfigMap
cm := v1.ConfigMap{}
err := unmarshal(path, &cm)