mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
added volumeNamePrefix and snapshotNamePrefix as parameters for storageClass
this allows administrators to override the naming prefix for both volumes and snapshots created by the rbd plugin. Signed-off-by: Reinier Schoof <reinier@skoef.nl>
This commit is contained in:
committed by
mergify[bot]
parent
8163552b81
commit
a4532fafd0
40
e2e/rbd.go
40
e2e/rbd.go
@ -2,6 +2,7 @@ package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo" // nolint
|
||||
|
||||
@ -339,6 +340,45 @@ var _ = Describe("RBD", func() {
|
||||
}
|
||||
})
|
||||
|
||||
By("create PVC in storageClass with volumeNamePrefix", func() {
|
||||
volumeNamePrefix := "foo-bar-"
|
||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||
createRBDStorageClass(f.ClientSet, f, map[string]string{"volumeNamePrefix": volumeNamePrefix})
|
||||
|
||||
// set up PVC
|
||||
pvc, err := loadPVC(pvcPath)
|
||||
if err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
pvc.Namespace = f.UniqueName
|
||||
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
|
||||
if err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
|
||||
// list RBD images and check if one of them has the same prefix
|
||||
foundIt := false
|
||||
for _, imgName := range listRBDImages(f) {
|
||||
fmt.Printf("Checking prefix on %s\n", imgName)
|
||||
if strings.HasPrefix(imgName, volumeNamePrefix) {
|
||||
foundIt = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// clean up after ourselves
|
||||
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
||||
if err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||
createRBDStorageClass(f.ClientSet, f, make(map[string]string))
|
||||
|
||||
if !foundIt {
|
||||
Fail(fmt.Sprintf("could not find image with prefix %s", volumeNamePrefix))
|
||||
}
|
||||
})
|
||||
|
||||
By("validate RBD static FileSystem PVC", func() {
|
||||
err := validateRBDStaticPV(f, appPath, false)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user