Skip to content

Commit

Permalink
Use LabelsAndGenerationPredicate for ToolchainClusterCache controller
Browse files Browse the repository at this point in the history
  • Loading branch information
rajivnathan committed Dec 10, 2024
1 parent e2e3546 commit 4a74816
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{})).

Check warning on line 35 in controllers/toolchainclustercache/toolchaincluster_cache_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/toolchainclustercache/toolchaincluster_cache_controller.go#L35

Added line #L35 was not covered by tests
Complete(r)
}

Expand Down

0 comments on commit 4a74816

Please sign in to comment.