Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #4340: add forType in binding status controller to inherit #4461

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/controllers/status/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import (
"github.com/karmada-io/karmada/pkg/util/restmapper"
)

// Fake predicate for inheriting concurrency of `forType` from global options.
// Matching the feature in later version.
var bindingPredicateFn = builder.WithPredicates(predicate.Funcs{
CreateFunc: func(event.CreateEvent) bool { return false },
UpdateFunc: func(event.UpdateEvent) bool { return false },
DeleteFunc: func(event.DeleteEvent) bool { return false },
GenericFunc: func(event.GenericEvent) bool { return false },
})

var workPredicateFn = builder.WithPredicates(predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool { return false },
UpdateFunc: func(e event.UpdateEvent) bool {
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/status/crb_status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (c *CRBStatusController) SetupWithManager(mgr controllerruntime.Manager) er
})

return controllerruntime.NewControllerManagedBy(mgr).Named("clusterResourceBinding_status_controller").
For(&workv1alpha2.ClusterResourceBinding{}, bindingPredicateFn).
Watches(&source.Kind{Type: &workv1alpha1.Work{}}, handler.EnqueueRequestsFromMapFunc(workMapFunc), workPredicateFn).
WithOptions(controller.Options{RateLimiter: ratelimiterflag.DefaultControllerRateLimiter(c.RateLimiterOptions)}).
Complete(c)
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/status/rb_status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (c *RBStatusController) SetupWithManager(mgr controllerruntime.Manager) err
})

return controllerruntime.NewControllerManagedBy(mgr).Named("resourceBinding_status_controller").
For(&workv1alpha2.ResourceBinding{}, bindingPredicateFn).
Watches(&source.Kind{Type: &workv1alpha1.Work{}}, handler.EnqueueRequestsFromMapFunc(workMapFunc), workPredicateFn).
WithOptions(controller.Options{RateLimiter: ratelimiterflag.DefaultControllerRateLimiter(c.RateLimiterOptions)}).
Complete(c)
Expand Down
Loading