From 1d7528aafceea6d59af9f4eee9915573d09fbaf6 Mon Sep 17 00:00:00 2001 From: Rewant Soni Date: Tue, 26 Nov 2024 23:11:25 +0530 Subject: [PATCH] controllers: fix mirroring controller 1. Update the mirroring finalizer to the right name 2. fix radosnamespace mirroring Signed-off-by: Rewant Soni --- controllers/mirroring/mirroring_controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/mirroring/mirroring_controller.go b/controllers/mirroring/mirroring_controller.go index 911e9e030d..55aa79ab83 100644 --- a/controllers/mirroring/mirroring_controller.go +++ b/controllers/mirroring/mirroring_controller.go @@ -46,7 +46,7 @@ import ( const ( // internalKey is a special key for storage-client-mapping to establish mirroring between blockPools for internal mode internalKey = "internal" - mirroringFinalizer = "mirroring.ocs.openshift.io" + mirroringFinalizer = "ocs.openshift.io/mirroring" clientIDIndexName = "clientID" ) @@ -429,7 +429,7 @@ func (r *MirroringReconciler) reconcileRadosNamespaceMirroring( ocsClient *providerClient.OCSProviderClient, clientMappingConfig *corev1.ConfigMap, storageClusterPeer *ocsv1.StorageClusterPeer, - disableMirroring bool, + shouldMirror bool, ) bool { /* Algorithm: @@ -520,13 +520,13 @@ func (r *MirroringReconciler) reconcileRadosNamespaceMirroring( remoteClientID := clientMappingConfig.Data[consumer.Status.Client.ID] remoteNamespace := remoteNamespaceByClientID[remoteClientID] _, err = controllerutil.CreateOrUpdate(r.ctx, r.Client, rns, func() error { - if remoteNamespace == "" || disableMirroring { - rns.Spec.Mirroring = nil - } else { + if remoteNamespace != "" && shouldMirror { rns.Spec.Mirroring = &rookCephv1.RadosNamespaceMirroring{ RemoteNamespace: ptr.To(remoteNamespace), Mode: "image", } + } else { + rns.Spec.Mirroring = nil } return nil })