Repository: rook/rook
Pull request #15033 (2024-11-20 12:54:44)

docs: update Ceph Block Pool CRD reference
# PR Summary
Commit 74431443e31eec775a8a89a4228edb78d6cff51e renamed `Documentation/ceph-pool-crd.md` to be `Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md`. This PR updates all references to reflect this change, removes unused links, and fixes extra parentheses in links that previously caused them not to render correctly.

**Checklist:**

- [x] **Commit Message Formatting**: Commit titles and messages follow guidelines in the [developer guide](https://rook.io/docs/rook/latest/Contributing/development-flow/#commit-structure).
- [x] Reviewed the developer guide on [Submitting a Pull Request](https://rook.io/docs/rook/latest/Contributing/development-flow/#submitting-a-pull-request)
- [ ] [Pending release notes](https://github.com/rook/rook/blob/master/PendingReleaseNotes.md) updated with breaking and/or notable changes for the next minor release.
- [ ] Documentation has been updated, if necessary.
- [ ] Unit tests have been added, if necessary.
- [ ] Integration tests have been added, if necessary.


emmanuel-ferdman: @travisn thank you for the review, can you do it on the merge button while selecting "squash"? 
travisn: > @travisn thank you for the review, can you do it on the merge button while selecting "squash" here in this PR Github page?

Unfortunately the commit history is not formatted as well in that case. We do have instructions [here](https://rook.io/docs/rook/latest-release/Contributing/development-flow/#commit-history) to help with the squash, if you wouldn't mind. Also, a note on the expected [commit structure](https://rook.io/docs/rook/latest-release/Contributing/development-flow/#commit-structure). Thanks

Patch:
diff --git a/design/ceph/ceph-nfs-ganesha.md b/design/ceph/ceph-nfs-ganesha.md
index 9baa05e1e..2dda5911d 100644
--- a/design/ceph/ceph-nfs-ganesha.md
+++ b/design/ceph/ceph-nfs-ganesha.md
@@ -44,7 +44,7 @@ This allows the NFS-Ganesha server cluster to be scalable and highly available.
   ```
 
 - An existing RADOS pool (e.g., CephFS's data pool) or a pool created with a
-  [Ceph Pool CRD] to store NFS client recovery data.
+  [Ceph Block Pool CRD] to store NFS client recovery data.
 
 ### Ceph NFS-Ganesha CRD
 
@@ -340,13 +340,11 @@ EXPORT {
 [NFS-Ganesha]: https://github.com/nfs-ganesha/nfs-ganesha/wiki
 [CephFS]: http://docs.ceph.com/docs/master/cephfs/nfs/
 [RGW]: http://docs.ceph.com/docs/master/radosgw/nfs/
-[Rook toolbox]: (/Documentation/ceph-toolbox.md)
-[Ceph manager]: (http://docs.ceph.com/docs/master/mgr/)
-[OpenStack]: (https://www.openstack.org/software/)
-[Manila]: (https://wiki.openstack.org/wiki/Manila)
-[CephFS driver]: (https://github.com/openstack/manila/blob/master/doc/source/admin/cephfs_driver.rst)
-[k8s ConfigMaps]: (https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/)
-[k8s Service]: (https://kubernetes.io/docs/concepts/services-networking/service)
-[Ceph Pool CRD]: (https://github.com/rook/rook/blob/master/Documentation/ceph-pool-crd.md)
-[k8s Deployments]: (https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
-[SSSD]: (https://sssd.io)
+[OpenStack]: https://www.openstack.org/software/
+[Manila]: https://wiki.openstack.org/wiki/Manila
+[CephFS driver]: https://github.com/openstack/manila/blob/master/doc/source/admin/cephfs_driver.rst
+[k8s ConfigMaps]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/
+[k8s Service]: https://kubernetes.io/docs/concepts/services-networking/service
+[Ceph Block Pool CRD]: https://github.com/rook/rook/blob/master/Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md
+[k8s Deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
+[SSSD]: https://sssd.io
diff --git a/pkg/operator/ceph/csi/ceph_connection.go b/pkg/operator/ceph/csi/ceph_connection.go
index 518b09d2f..bedb6664b 100644
--- a/pkg/operator/ceph/csi/ceph_connection.go
+++ b/pkg/operator/ceph/csi/ceph_connection.go
@@ -17,13 +17,10 @@ limitations under the License.
 package csi
 
 import (
-	"os"
-
 	"github.com/pkg/errors"
 
 	cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
 	cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
-	"github.com/rook/rook/pkg/operator/k8sutil"
 
 	csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1"
 	kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -37,13 +34,18 @@ func CreateUpdateCephConnection(c client.Client, clusterInfo *cephclient.Cluster
 	csiCephConnection := &csiopv1a1.CephConnection{}
 
 	csiCephConnection.Name = clusterInfo.NamespacedName().Name
-	csiCephConnection.Namespace = os.Getenv(k8sutil.PodNamespaceEnvVar)
+	csiCephConnection.Namespace = clusterInfo.NamespacedName().Namespace
 
 	spec, err := generateCephConnSpec(c, clusterInfo, csiCephConnection.Spec, clusterSpec)
 	if err != nil {
 		return errors.Wrapf(err, "failed to set ceph connection CR %q in namespace %q", csiCephConnection.Name, clusterInfo.Namespace)
 	}
 
+	err = clusterInfo.OwnerInfo.SetOwnerReference(csiCephConnection)
+	if err != nil {
+		return errors.Wrapf(err, "failed to set owner reference for ceph connection CR %q", csiCephConnection.Name)
+	}
+
 	err = c.Get(clusterInfo.Context, types.NamespacedName{Name: csiCephConnection.Name, Namespace: csiCephConnection.Namespace}, csiCephConnection)
 	if err != nil {
 		if kerrors.IsNotFound(err) {
diff --git a/pkg/operator/ceph/csi/config.go b/pkg/operator/ceph/csi/config.go
index 1d733aa69..482c71545 100644
--- a/pkg/operator/ceph/csi/config.go
+++ b/pkg/operator/ceph/csi/config.go
@@ -18,14 +18,9 @@ package csi
 
 import (
 	"context"
-	"os"
-	"reflect"
-	"runtime/debug"
 	"strings"
 
-	cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
 	cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
-	"github.com/rook/rook/pkg/operator/k8sutil"
 
 	csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1"
 	"github.com/pkg/errors"
@@ -41,7 +36,7 @@ func CreateUpdateClientProfileRadosNamespace(ctx context.Context, c client.Clien
 
 	csiOpClientProfile := &csiopv1a1.ClientProfile{}
 	csiOpClientProfile.Name = clusterID
-	csiOpClientProfile.Namespace = os.Getenv(k8sutil.PodNamespaceEnvVar)
+	csiOpClientProfile.Namespace = cephBlockPoolRadosNamespacedName.Namespace
 	csiOpClientProfile.Spec = csiopv1a1.ClientProfileSpec{
 		CephConnectionRef: v1.LocalObjectReference{
 			Name: clusterName,
@@ -51,7 +46,12 @@ func CreateUpdateClientProfileRadosNamespace(ctx context.Context, c client.Clien
 		},
 	}
 
-	err := c.Get(ctx, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
+	err := clusterInfo.OwnerInfo.SetOwnerReference(csiOpClientProfile)
+	if err != nil {
+		return errors.Wrapf(err, "failed to set owner reference for clientProfile CR %q for radosNamespace", csiOpClientProfile.Name)
+	}
+
+	err = c.Get(ctx, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
 	if err != nil {
 		if apierrors.IsNotFound(err) {
 			err = c.Create(ctx, csiOpClientProfile)
@@ -79,7 +79,12 @@ func CreateUpdateClientProfileSubVolumeGroup(ctx context.Context, c client.Clien
 
 	csiOpClientProfile := generateProfileSubVolumeGroupSpec(clusterInfo, cephFilesystemNamespacedName, clusterID, clusterName)
 
-	err := c.Get(ctx, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
+	err := clusterInfo.OwnerInfo.SetOwnerReference(csiOpClientProfile)
+	if err != nil {
+		return errors.Wrapf(err, "failed to set owner reference for clientProfile CR %q for subVolGrp", csiOpClientProfile.Name)
+	}
+
+	err = c.Get(ctx, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
 	if err != nil {
 		if apierrors.IsNotFound(err) {
 			err = c.Create(ctx, csiOpClientProfile)
@@ -104,7 +109,7 @@ func CreateUpdateClientProfileSubVolumeGroup(ctx context.Context, c client.Clien
 func generateProfileSubVolumeGroupSpec(clusterInfo *cephclient.ClusterInfo, cephFilesystemNamespacedName types.NamespacedName, clusterID, clusterName string) *csiopv1a1.ClientProfile {
 	csiOpClientProfile := &csiopv1a1.ClientProfile{}
 	csiOpClientProfile.Name = clusterID
-	csiOpClientProfile.Namespace = os.Getenv(k8sutil.PodNamespaceEnvVar)
+	csiOpClientProfile.Namespace = cephFilesystemNamespacedName.Namespace
 	csiOpClientProfile.Spec = csiopv1a1.ClientProfileSpec{
 		CephConnectionRef: v1.LocalObjectReference{
 			Name: clusterName,
@@ -114,14 +119,15 @@ func generateProfileSubVolumeGroupSpec(clusterInfo *cephclient.ClusterInfo, ceph
 		},
 	}
 
-	if !reflect.DeepEqual(clusterInfo.CSIDriverSpec.CephFS, cephv1.CSICephFSSpec{}) {
-		if clusterInfo.CSIDriverSpec.CephFS.KernelMountOptions != "" {
-			kernelMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.KernelMountOptions, "=")
-			csiOpClientProfile.Spec.CephFs.KernelMountOptions = map[string]string{kernelMountKeyVal[0]: kernelMountKeyVal[1]}
-		} else if clusterInfo.CSIDriverSpec.CephFS.FuseMountOptions != "" {
-			fuseMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.FuseMountOptions, "=")
-			csiOpClientProfile.Spec.CephFs.FuseMountOptions = map[string]string{fuseMountKeyVal[0]: fuseMountKeyVal[1]}
-		}
+	kernelMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.KernelMountOptions, "=")
+	fuseMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.FuseMountOptions, "=")
+
+	if len(kernelMountKeyVal) == 2 {
+		csiOpClientProfile.Spec.CephFs.KernelMountOptions = map[string]string{kernelMountKeyVal[0]: kernelMountKeyVal[1]}
+	}
+
+	if len(fuseMountKeyVal) == 2 {
+		csiOpClientProfile.Spec.CephFs.FuseMountOptions = map[string]string{fuseMountKeyVal[0]: fuseMountKeyVal[1]}
 	}
 
 	return csiOpClientProfile
@@ -130,42 +136,22 @@ func generateProfileSubVolumeGroupSpec(clusterInfo *cephclient.ClusterInfo, ceph
 // CreateDefaultClientProfile creates a default client profile for csi-operator to connect driver
 func CreateDefaultClientProfile(c client.Client, clusterInfo *cephclient.ClusterInfo, namespaced types.NamespacedName) error {
 	logger.Info("Creating ceph-csi clientProfile default CR")
-	defer func() {
-		if r := recover(); r != nil {
-			logger.Errorf("Panic when creating the default client profile: %+v", r)
-			logger.Errorf("Stack trace:")
-			logger.Errorf(string(debug.Stack()))
-		}
-	}()
 
 	csiOpClientProfile := &csiopv1a1.ClientProfile{}
 	csiOpClientProfile.Name = clusterInfo.Namespace
-	csiOpClientProfile.Namespace = os.Getenv(k8sutil.PodNamespaceEnvVar)
+	csiOpClientProfile.Namespace = clusterInfo.Namespace
 	csiOpClientProfile.Spec = csiopv1a1.ClientProfileSpec{
 		CephConnectionRef: v1.LocalObjectReference{
 			Name: namespaced.Name,
 		},
 	}
 
-	if !reflect.DeepEqual(clusterInfo.CSIDriverSpec.CephFS, cephv1.CSICephFSSpec{}) {
-		if clusterInfo.CSIDriverSpec.CephFS.KernelMountOptions != "" {
-			kernelMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.KernelMountOptions, "=")
-			if len(kernelMountKeyVal) >= 2 {
-				csiOpClientProfile.Spec.CephFs = &csiopv1a1.CephFsConfigSpec{
-					KernelMountOptions: map[string]string{kernelMountKeyVal[0]: kernelMountKeyVal[1]},
-				}
-			}
-		} else if clusterInfo.CSIDriverSpec.CephFS.FuseMountOptions != "" {
-			fuseMountKeyVal := strings.Split(clusterInfo.CSIDriverSpec.CephFS.FuseMountOptions, "=")
-			if len(fuseMountKeyVal) >= 2 {
-				csiOpClientProfile.Spec.CephFs = &csiopv1a1.CephFsConfigSpec{
-					FuseMountOptions: map[string]string{fuseMountKeyVal[0]: fuseMountKeyVal[1]},
-				}
-			}
-		}
+	err := clusterInfo.OwnerInfo.SetOwnerReference(csiOpClientProfile)
+	if err != nil {
+		return errors.Wrapf(err, "failed to set owner reference for default clientProfile CR %q", csiOpClientProfile.Name)
 	}
 
-	err := c.Get(clusterInfo.Context, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
+	err = c.Get(clusterInfo.Context, types.NamespacedName{Name: csiOpClientProfile.Name, Namespace: csiOpClientProfile.Namespace}, csiOpClientProfile)
 	if err != nil {
 		if apierrors.IsNotFound(err) {
 			err = c.Create(clusterInfo.Context, csiOpClientProfile)
diff --git a/pkg/operator/ceph/csi/operator_config.go b/pkg/operator/ceph/csi/operator_config.go
index 638e512b2..d1aceecfb 100644
--- a/pkg/operator/ceph/csi/operator_config.go
+++ b/pkg/operator/ceph/csi/operator_config.go
@@ -17,6 +17,8 @@ limitations under the License.
 package csi
 
 import (
+	"reflect"
+
 	cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
 
 	csiopv1a1 "github.com/ceph/ceph-csi-operator/api/v1alpha1"
@@ -117,11 +119,14 @@ func (r *ReconcileCSI) generateCSIOpConfigSpec(cluster cephv1.CephCluster, opCon
 			CephFsClientType: cephfsClientType,
 		},
 	}
-	if CSIParam.EnableCSIEncryption {
-		opConfig.Spec.DriverSpecDefaults.Encryption = &csiopv1a1.EncryptionSpec{
-			ConfigMapRef: v1.LocalObjectReference{
-				Name: "rook-ceph-csi-kms-config",
-			},
+	if !reflect.DeepEqual(cluster.Spec.Network, cephv1.NetworkSpec{}) {
+
+		if cluster.Spec.Network.Connections.Encryption.Enabled {
+			opConfig.Spec.DriverSpecDefaults.Encryption = &csiopv1a1.EncryptionSpec{
+				ConfigMapRef: v1.LocalObjectReference{
+					Name: "rook-ceph-csi-kms-config",
+				},
+			}
 		}
 	}
 
diff --git a/pkg/operator/ceph/csi/operator_driver.go b/pkg/operator/ceph/csi/operator_driver.go
index 165107da3..e13f5afee 100644
--- a/pkg/operator/ceph/csi/operator_driver.go
+++ b/pkg/operator/ceph/csi/operator_driver.go
@@ -41,35 +41,35 @@ func (r *ReconcileCSI) createOrUpdateDriverResources(cluster cephv1.CephCluster,
 
 	if EnableRBD {
 		logger.Info("Creating RBD driver resources")
-		err := r.transferCSIDriverOwner(r.opManagerContext, RBDDriverName)
+		err := r.transferCSIDriverOwner(r.opManagerContext, clusterInfo, RBDDriverName)
 		if err != nil {
 			return errors.Wrap(err, "failed to create update RBD driver for csi-operator driver CR ")
 		}
 		err = r.createOrUpdateRBDDriverResource(cluster, clusterInfo)
 		if err != nil {
-			return errors.Wrapf(err, "failed to create or update RBD driver resource in the namespace %q", r.opConfig.OperatorNamespace)
+			return errors.Wrapf(err, "failed to create or update RBD driver resource in the namespace %q", clusterInfo.Namespace)
 		}
 	}
 	if EnableCephFS {
 		logger.Info("Creating CephFS driver resources")
-		err := r.transferCSIDriverOwner(r.opManagerContext, CephFSDriverName)
+		err := r.transferCSIDriverOwner(r.opManagerContext, clusterInfo, CephFSDriverName)
 		if err != nil {
 			return errors.Wrap(err, "failed to create update CephFS driver for csi-operator driver CR ")
 		}
 		err = r.createOrUpdateCephFSDriverResource(cluster, clusterInfo)
 		if err != nil {
-			return errors.Wrapf(err, "failed to create or update cephFS driver resource in the namespace %q", r.opConfig.OperatorNamespace)
+			return errors.Wrapf(err, "failed to create or update cephFS driver resource in the namespace %q", clusterInfo.Namespace)
 		}
 	}
 	if EnableNFS {
 		logger.Info("Creating NFS driver resources")
-		err := r.transferCSIDriverOwner(r.opManagerContext, NFSDriverName)
+		err := r.transferCSIDriverOwner(r.opManagerContext, clusterInfo, NFSDriverName)
 		if err != nil {
 			return errors.Wrap(err, "failed to create update NFS driver for csi-operator driver CR ")
 		}
 		err = r.createOrUpdateNFSDriverResource(cluster, clusterInfo)
 		if err != nil {
-			return errors.Wrapf(err, "failed to create or update NFS driver resource in the namespace %q", r.opConfig.OperatorNamespace)
+			return errors.Wrapf(err, "failed to create or update NFS driver resource in the namespace %q", clusterInfo.Namespace)
 		}
 	}
 
@@ -77,7 +77,7 @@ func (r *ReconcileCSI) createOrUpdateDriverResources(cluster cephv1.CephCluster,
 }
 
 func (r *ReconcileCSI) createOrUpdateRBDDriverResource(cluster cephv1.CephCluster, clusterInfo *cephclient.ClusterInfo) error {
-	resourceName := fmt.Sprintf("%s.rbd.csi.ceph.com", r.opConfig.OperatorNamespace)
+	resourceName := fmt.Sprintf("%s.rbd.csi.ceph.com", clusterInfo.Namespace)
 	spec, err := r.generateDriverSpec(cluster.Name)
 	if err != nil {
 		return err
@@ -87,7 +87,7 @@ func (r *ReconcileCSI) createOrUpdateRBDDriverResource(cluster cephv1.CephCluste
 		TypeMeta: metav1.TypeMeta{},
 		ObjectMeta: metav1.ObjectMeta{
 			Name:      resourceName,
-			Namespace: r.opConfig.OperatorNamespace,
+			Namespace: clusterInfo.Namespace,
 		},
 		Spec: spec,
 	}
@@ -123,7 +123,7 @@ func (r *ReconcileCSI) createOrUpdateRBDDriverResource(cluster cephv1.CephCluste
 }
 
 func (r *ReconcileCSI) createOrUpdateCephFSDriverResource(cluster cephv1.CephCluster, clusterInfo *cephclient.ClusterInfo) error {
-	resourceName := fmt.Sprintf("%s.cephfs.csi.ceph.com", r.opConfig.OperatorNamespace)
+	resourceName := fmt.Sprintf("%s.cephfs.csi.ceph.com", clusterInfo.Namespace)
 	spec, err := r.generateDriverSpec(cluster.Name)
 	if err != nil {
 		return err
@@ -133,7 +133,7 @@ func (r *ReconcileCSI) createOrUpdateCephFSDriverResource(cluster cephv1.CephClu
 		TypeMeta: metav1.TypeMeta{},
 		ObjectMeta: metav1.ObjectMeta{
 			Name:      resourceName,
-			Namespace: r.opConfig.OperatorNamespace,
+			Namespace: clusterInfo.Namespace,
 		},
 		Spec: spec,
 	}
@@ -175,7 +175,7 @@ func (r *ReconcileCSI) createOrUpdateCephFSDriverResource(cluster cephv1.CephClu
 }
 
 func (r *ReconcileCSI) createOrUpdateNFSDriverResource(cluster cephv1.CephCluster, clusterInfo *cephclient.ClusterInfo) error {
-	resourceName := fmt.Sprintf("%s.nfs.csi.ceph.com", r.opConfig.OperatorNamespace)
+	resourceName := fmt.Sprintf("%s.nfs.csi.ceph.com", clusterInfo.Namespace)
 	spec, err := r.generateDriverSpec(cluster.Name)
 	if err != nil {
 		return err
@@ -185,7 +185,7 @@ func (r *ReconcileCSI) createOrUpdateNFSDriverResource(cluster cephv1.CephCluste
 		TypeMeta: metav1.TypeMeta{},
 		ObjectMeta: metav1.ObjectMeta{
 			Name:      resourceName,
-			Namespace: r.opConfig.OperatorNamespace,
+			Namespace: clusterInfo.Namespace,
 		},
 		Spec: spec,
 	}
@@ -221,7 +221,7 @@ func (r *ReconcileCSI) createOrUpdateNFSDriverResource(cluster cephv1.CephCluste
 func (r ReconcileCSI) createOrUpdateDriverResource(clusterInfo *cephclient.ClusterInfo, driverResource *csiopv1a1.Driver) error {
 	spec := driverResource.Spec
 
-	err := r.client.Get(r.opManagerContext, types.NamespacedName{Name: driverResource.Name, Namespace: r.opConfig.OperatorNamespace}, driverResource)
+	err := r.client.Get(r.opManagerContext, types.NamespacedName{Name: driverResource.Name, Namespace: clusterInfo.Namespace}, driverResource)
 	if err != nil {
 		if kerrors.IsNotFound(err) {
 			err = r.client.Create(r.opManagerContext, driverResource)
@@ -380,7 +380,7 @@ func createDriverNodePluginResouces(opConfig map[string]string, key string) csio
 }
 
 // transferCSIDriverOwner update CSIDriver and returns the error if any
-func (r *ReconcileCSI) transferCSIDriverOwner(ctx context.Context, name string) error {
+func (r *ReconcileCSI) transferCSIDriverOwner(ctx context.Context, clusterInfo *cephclient.ClusterInfo, name string) error {
 
 	logger.Info("adding annotation to CSIDriver resource for csi-operator to own it")
 	csiDriver, err := r.context.Clientset.StorageV1().CSIDrivers().Get(ctx, name, metav1.GetOptions{})
@@ -393,7 +393,6 @@ func (r *ReconcileCSI) transferCSIDriverOwner(ctx context.Context, name string)
 
 	key := "csi.ceph.io/ownerref"
 	ownerObjKey := client.ObjectKeyFromObject(csiDriver)
-	ownerObjKey.Namespace = r.opConfig.OperatorNamespace
 	val, err := json.Marshal(ownerObjKey)
 	if err != nil {
 		return errors.Wrapf(err, "failed to marshal owner object key %q", ownerObjKey.Name)


Test patch:
diff --git a/pkg/operator/ceph/csi/ceph_connection_test.go b/pkg/operator/ceph/csi/ceph_connection_test.go
index b3e241a63..c2f6f4396 100644
--- a/pkg/operator/ceph/csi/ceph_connection_test.go
+++ b/pkg/operator/ceph/csi/ceph_connection_test.go
@@ -24,7 +24,6 @@ import (
 	cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
 	"github.com/rook/rook/pkg/client/clientset/versioned/scheme"
 	clienttest "github.com/rook/rook/pkg/daemon/ceph/client/test"
-	"github.com/rook/rook/pkg/operator/k8sutil"
 	"github.com/stretchr/testify/assert"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
@@ -38,7 +37,6 @@ func TestCreateUpdateCephConnection(t *testing.T) {
 	c.Namespace = ns
 	c.SetName("testcluster")
 	c.NamespacedName()
-	t.Setenv(k8sutil.PodNamespaceEnvVar, ns)
 
 	cluster := &cephv1.CephCluster{
 		ObjectMeta: metav1.ObjectMeta{
diff --git a/pkg/operator/ceph/csi/config_test.go b/pkg/operator/ceph/csi/config_test.go
index 8ac0c45c9..089d0ae5a 100644
--- a/pkg/operator/ceph/csi/config_test.go
+++ b/pkg/operator/ceph/csi/config_test.go
@@ -25,7 +25,6 @@ import (
 	cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
 	"github.com/rook/rook/pkg/client/clientset/versioned/scheme"
 	clienttest "github.com/rook/rook/pkg/daemon/ceph/client/test"
-	"github.com/rook/rook/pkg/operator/k8sutil"
 	"github.com/stretchr/testify/assert"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/types"
@@ -49,9 +48,6 @@ func TestCreateUpdateClientProfile(t *testing.T) {
 	c.Namespace = ns
 	c.SetName("testcluster")
 	c.NamespacedName()
-	c.SetName(c.Namespace)
-	t.Setenv(k8sutil.PodNamespaceEnvVar, ns)
-
 	clusterName := "testClusterName"
 	cephBlockPoolRadosNamespacedName := types.NamespacedName{Namespace: ns, Name: "cephBlockPoolRadosNames"}
 	cephSubVolGrpNamespacedName := types.NamespacedName{Namespace: ns, Name: "cephSubVolumeGroupNames"}
diff --git a/pkg/operator/ceph/csi/operator_config_test.go b/pkg/operator/ceph/csi/operator_config_test.go
index a260a628f..33f10c2a5 100644
--- a/pkg/operator/ceph/csi/operator_config_test.go
+++ b/pkg/operator/ceph/csi/operator_config_test.go
@@ -88,4 +88,5 @@ func TestReconcileCSI_createOrUpdateOperatorConfig(t *testing.T) {
 	err = cl.Get(context.TODO(), types.NamespacedName{Name: opConfigCRName, Namespace: r.opConfig.OperatorNamespace}, opConfig)
 	assert.NoError(t, err)
 	assert.Equal(t, *opConfig.Spec.DriverSpecDefaults.EnableMetadata, false)
+	assert.Equal(t, opConfig.Spec.DriverSpecDefaults.Encryption.ConfigMapRef, v1.LocalObjectReference{Name: "rook-ceph-csi-kms-config"})
 }