deploy: add csidriver object for cephfs and rbd

csidriver object can be created on the kubernetes
for below reason.

If a CSI driver creates a CSIDriver object,
Kubernetes users can easily discover the CSI
Drivers installed on their cluster
(simply by issuing kubectl get CSIDriver)

Ref: https://kubernetes-csi.github.io/docs/csi-driver-object.html#what-is-the-csidriver-object

attachRequired is always required to be set to
true to avoid issue on RWO PVC.

more details about it at https://github.com/rook/rook/pull/4332

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2021-03-30 11:03:01 +05:30
committed by mergify[bot]
parent d80b8d7fc5
commit fba6a2d0c3
6 changed files with 63 additions and 10 deletions

View File

@ -3,6 +3,8 @@ package e2e
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
@ -61,6 +63,19 @@ func deleteCephfsPlugin() {
}
func createORDeleteCephfsResouces(action string) {
csiDriver, err := ioutil.ReadFile(cephfsDirPath + csiDriverObject)
if err != nil {
// createORDeleteRbdResouces is used for upgrade testing as csidriverObject is
// newly added, discarding file not found error.
if !os.IsNotExist(err) {
e2elog.Failf("failed to read content from %s with error %v", cephfsDirPath+csiDriverObject, err)
}
} else {
_, err = framework.RunKubectlInput(cephCSINamespace, string(csiDriver), action, "-f", "-")
if err != nil {
e2elog.Failf("failed to %s CSIDriver object with error %v", action, err)
}
}
data, err := replaceNamespaceInTemplate(cephfsDirPath + cephfsProvisioner)
if err != nil {
e2elog.Failf("failed to read content from %s with error %v", cephfsDirPath+cephfsProvisioner, err)

View File

@ -3,6 +3,8 @@ package e2e
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
@ -23,6 +25,7 @@ var (
rbdNodePluginRBAC = "csi-nodeplugin-rbac.yaml"
rbdNodePluginPSP = "csi-nodeplugin-psp.yaml"
configMap = "csi-config-map.yaml"
csiDriverObject = "csidriver.yaml"
rbdDirPath = "../deploy/rbd/kubernetes/"
rbdExamplePath = "../examples/rbd/"
rbdDeploymentName = "csi-rbdplugin-provisioner"
@ -67,6 +70,19 @@ func deleteRBDPlugin() {
}
func createORDeleteRbdResouces(action string) {
csiDriver, err := ioutil.ReadFile(rbdDirPath + csiDriverObject)
if err != nil {
// createORDeleteRbdResouces is used for upgrade testing as csidriverObject is
// newly added, discarding file not found error.
if !os.IsNotExist(err) {
e2elog.Failf("failed to read content from %s with error %v", rbdDirPath+csiDriverObject, err)
}
} else {
_, err = framework.RunKubectlInput(cephCSINamespace, string(csiDriver), action, "-f", "-")
if err != nil {
e2elog.Failf("failed to %s CSIDriver object with error %v", action, err)
}
}
data, err := replaceNamespaceInTemplate(rbdDirPath + rbdProvisioner)
if err != nil {
e2elog.Failf("failed to read content from %s with error %v", rbdDirPath+rbdProvisioner, err)