From 459633f4fc8e3a621688b8431f96318ebf3bd8b1 Mon Sep 17 00:00:00 2001 From: Rewant Soni Date: Mon, 2 Dec 2024 17:28:34 +0530 Subject: [PATCH] controllers: watch for consumer annotation in mirroring controller As the mirroring controller, lists consumers based on annotation to trigger maintenance mode, add watch for storageconsumer annotation change in mirroring controller Signed-off-by: Rewant Soni --- controllers/mirroring/mirroring_controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/mirroring/mirroring_controller.go b/controllers/mirroring/mirroring_controller.go index 55aa79ab83..00588b15da 100644 --- a/controllers/mirroring/mirroring_controller.go +++ b/controllers/mirroring/mirroring_controller.go @@ -16,7 +16,6 @@ package mirroring import ( "context" "fmt" - controllers "github.com/red-hat-storage/ocs-operator/v4/controllers/storageconsumer" "golang.org/x/exp/maps" "k8s.io/utils/ptr" "slices" @@ -25,6 +24,7 @@ import ( ocsv1 "github.com/red-hat-storage/ocs-operator/api/v4/v1" ocsv1alpha1 "github.com/red-hat-storage/ocs-operator/api/v4/v1alpha1" providerClient "github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client" + controllers "github.com/red-hat-storage/ocs-operator/v4/controllers/storageconsumer" "github.com/red-hat-storage/ocs-operator/v4/controllers/util" "github.com/go-logr/logr" @@ -119,7 +119,12 @@ func (r *MirroringReconciler) SetupWithManager(mgr ctrl.Manager) error { Watches( &ocsv1alpha1.StorageConsumer{}, enqueueConfigMapRequest, - generationChangePredicate, + builder.WithPredicates( + predicate.Or( + predicate.AnnotationChangedPredicate{}, + predicate.GenerationChangedPredicate{}, + ), + ), ). Watches( &rookCephv1.CephBlockPool{},