-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow controller authors to configure queue rate limits #631
Comments
/kind feature As long as we're careful not to tie ourselves to closely to the exact interfaces or semantics of the underlying apimachinery libraries, this seems like a reasonable request |
https://godoc.org/k8s.io/client-go/util/workqueue#RateLimiter is the interface // Options are the arguments for creating a new Controller
type Options struct {
// ... existing fields omitted
// A RateLimiter used to limit how frequently requests may be queued.
// Defaults to <brief summary of DefaultControllerRateLimiter semantics>.
RateLimiter workqueue.RateLimiter
}
// New returns a new Controller registered with the Manager. The Manager will ensure that shared Caches have
// been synced before the Controller is Started.
func New(name string, mgr manager.Manager, options Options) (Controller, error) {
if options.RateLimiter == nil {
options.RateLimiter = workqueue.DefaultControllerRateLimiter()
}
// Make a great new controller...
} @DirectXMan12 Would you be concerned about leaking that interface to controller-runtime users? If so, would you want to try to alter the interface, or would it be sufficient to define an identical interface inside the |
the more we expose from apimachinery, the more likely something explodes dramatically in our faces when someone decides that a method name needs to change, or an interface needs to go away, or whatnot (cough 1.16 apimachinery cough). That's one of my big concerns. To clarify: what's the exact desire here -- set the backoff? Control the backoff in a more granular manner? That interface is decent if we need the latter -- we just need to make sure we can always support it. |
It's not immediately obvious to me what the difference between those two options is, so "yes". :) I'd like:
|
Yeah, that makes sense. Exposing an option to configure the rate-limiter is probably fine. |
We have the exact same use case in controlling backoff. So this would be really useful. @DirectXMan12 Does it make sense to add a new |
Fix function comments based on best practices from Effective Go
/kind design |
Controllers created using controller-runtime implicitly use the
DefaultControllerRateLimiter
for the work queue they use to process reconcile requests. If I follow the logic correctly, this means that under the following conditions...Result{Requeue: true}
...the earliest time the resulting reconcile will be processed will be the maximum of:
Result{Requeue: false}, nil
orResult{RequeueAfter: N}, nil
).While building Crossplane we've found these requeue semantics are not ideal for reconciling Kubernetes resources with cloud provider APIs. There are two parts to this:
I believe we could solve both of the above issues if we were able to override the default rate limiter, perhaps by adding it to
controller.Options
. This would allow us to tweak the exponential backoff parameters, and to plumb the rate limiter through to our Reconciler so it could inform concerned parties when an object was next going to be reconciled.Relates to #195 and #417.
The text was updated successfully, but these errors were encountered: