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

add forType in binding status controller to inherit concurrency declared in global options #4340

Merged
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{
lxtywypc marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -86,6 +86,7 @@ func (c *CRBStatusController) SetupWithManager(mgr controllerruntime.Manager) er
})

return controllerruntime.NewControllerManagedBy(mgr).Named("clusterResourceBinding_status_controller").
For(&workv1alpha2.ClusterResourceBinding{}, bindingPredicateFn).
Watches(&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 @@ -88,6 +88,7 @@ func (c *RBStatusController) SetupWithManager(mgr controllerruntime.Manager) err
})

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