From 98a17f00ccdd956d2d8dcce6ba633786d9a927d6 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Fri, 15 Mar 2024 18:12:16 +0530 Subject: [PATCH] add ROOK_OBC_PROVISIONER_NAME_PREFIX to Rook Config Similar to CSI_DRIVER_NAME_PREFIX for obc provisioner so that the obc provisioner always checks for storageclass with name `openshift-storage.ceph.rook.io/bucket` Signed-off-by: Jiffin Tony Thottan --- controllers/storagecluster/generate.go | 2 +- controllers/storagecluster/storageclasses.go | 14 +++++++------- .../ocs-operator.clusterserviceversion.yaml | 2 ++ tools/csv-merger/csv-merger.go | 4 ++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/controllers/storagecluster/generate.go b/controllers/storagecluster/generate.go index 644217ee04..be9f10005a 100644 --- a/controllers/storagecluster/generate.go +++ b/controllers/storagecluster/generate.go @@ -116,7 +116,7 @@ func generateNameForSnapshotClass(initData *ocsv1.StorageCluster, snapshotType S } func generateNameForSnapshotClassDriver(snapshotType SnapshotterType) string { - return fmt.Sprintf("%s.%s.csi.ceph.com", csiDriverNamePrefix, snapshotType) + return fmt.Sprintf("%s.%s.csi.ceph.com", storageclassDriverNamePrefix, snapshotType) } func generateNameForSnapshotClassSecret(instance *ocsv1.StorageCluster, snapshotType SnapshotterType) string { diff --git a/controllers/storagecluster/storageclasses.go b/controllers/storagecluster/storageclasses.go index aa2bc06d20..ec244c63ec 100644 --- a/controllers/storagecluster/storageclasses.go +++ b/controllers/storagecluster/storageclasses.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "os" "reflect" "strings" @@ -27,14 +26,15 @@ const ( storageClassSkippedError = "some StorageClasses were skipped while waiting for pre-requisites to be met" defaultStorageClassAnnotation = "storageclass.kubernetes.io/is-default-class" - //csi driver name prefix - csiDriverNamePrefix = "openshift-storage" + //storage class driver name prefix + storageclassDriverNamePrefix = "openshift-storage" ) var ( - rbdDriverName = csiDriverNamePrefix + ".rbd.csi.ceph.com" - cephFSDriverName = csiDriverNamePrefix + ".cephfs.csi.ceph.com" - nfsDriverName = csiDriverNamePrefix + ".nfs.csi.ceph.com" + rbdDriverName = storageclassDriverNamePrefix + ".rbd.csi.ceph.com" + cephFSDriverName = storageclassDriverNamePrefix + ".cephfs.csi.ceph.com" + nfsDriverName = storageclassDriverNamePrefix + ".nfs.csi.ceph.com" + obcDriverName = storageclassDriverNamePrefix + ".ceph.rook.io/bucket" ) // StorageClassConfiguration provides configuration options for a StorageClass. @@ -426,7 +426,7 @@ func newCephOBCStorageClassConfiguration(initData *ocsv1.StorageCluster) Storage "description": "Provides Object Bucket Claims (OBCs)", }, }, - Provisioner: fmt.Sprintf("%s.ceph.rook.io/bucket", os.Getenv(util.OperatorNamespaceEnvVar)), + Provisioner: obcDriverName, ReclaimPolicy: &reclaimPolicy, Parameters: map[string]string{ "objectStoreNamespace": initData.Namespace, diff --git a/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml b/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml index 9376976fc5..36bcfa6bfa 100644 --- a/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml +++ b/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml @@ -3247,6 +3247,8 @@ spec: fieldPath: metadata.namespace - name: ROOK_OBC_WATCH_OPERATOR_NAMESPACE value: "true" + - name: ROOK_OBC_PROVISIONER_NAME_PREFIX + value: openshift-storage image: docker.io/rook/ceph:v1.13.0-beta.0.41.g1647c2afc name: rook-ceph-operator resources: {} diff --git a/tools/csv-merger/csv-merger.go b/tools/csv-merger/csv-merger.go index 072cfa63cd..4fed841430 100644 --- a/tools/csv-merger/csv-merger.go +++ b/tools/csv-merger/csv-merger.go @@ -369,6 +369,10 @@ func unmarshalCSV(filePath string) *csvv1.ClusterServiceVersion { Name: "ROOK_OBC_WATCH_OPERATOR_NAMESPACE", Value: "true", }, + { + Name: "ROOK_OBC_PROVISIONER_NAME_PREFIX", + Value: "openshift-storage", + }, } if *rookCsiCephImage != "" {