From 463b623cd97191b601e6a2b08b5142c39486b56f Mon Sep 17 00:00:00 2001 From: Rajiv Senthilnathan Date: Tue, 10 Dec 2024 13:12:50 -0500 Subject: [PATCH] Use LabelsAndGenerationPredicate for ToolchainClusterCache controller (#437) --- .../toolchainclustercache/toolchaincluster_cache_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/toolchainclustercache/toolchaincluster_cache_controller.go b/controllers/toolchainclustercache/toolchaincluster_cache_controller.go index b39f64fd..131caaf0 100644 --- a/controllers/toolchainclustercache/toolchaincluster_cache_controller.go +++ b/controllers/toolchainclustercache/toolchaincluster_cache_controller.go @@ -6,6 +6,7 @@ import ( toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1" "github.com/codeready-toolchain/toolchain-common/pkg/cluster" + commonpredicates "github.com/codeready-toolchain/toolchain-common/pkg/predicate" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" @@ -31,7 +32,7 @@ func NewReconciler(mgr manager.Manager, namespace string, timeout time.Duration) // SetupWithManager sets up the controller with the Manager. func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&toolchainv1alpha1.ToolchainCluster{}, builder.WithPredicates(namespacePredicate{namespace: r.namespace})). + For(&toolchainv1alpha1.ToolchainCluster{}, builder.WithPredicates(namespacePredicate{namespace: r.namespace}, commonpredicates.LabelsAndGenerationPredicate{})). Complete(r) }