Skip to content

Predicates seems to not work as expected #2950

Closed Answered by camilamacedo86
plaffitt asked this question in Support
Discussion options

You must be logged in to vote

Hello @paullaffitte,

It looks like you've tried multiple approaches to filter out events using predicates. Predicates are a powerful way to ensure that your controller only reconciles objects that meet certain conditions.

Your original attempts were trying to filter out all the events by returning false, which should effectively mean your reconciler doesn't get triggered at all. If it's still reconciling, it might be because of another controller or an error in your setup.

However, it might be the correction:

func (r *PodReconciler) SetupWithManager(mgr ctrl.Manager) error {
	return ctrl.NewControllerManagedBy(mgr).
		For(&corev1.Pod{}, builder.WithPredicates(predicate.NewPredicateFuncs(func

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by camilamacedo86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants