Commit Graph

16 Commits

Author SHA1 Message Date
Silvio Moioli 89b352efa3
Update pkg/controller/controller.go
Co-authored-by: Tom Lebreux <me@tomlebreux.com>
2024-02-27 12:43:24 +01:00
Silvio Moioli 8b8bf070a8
Explain default rate limiting behavior
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2023-08-04 16:47:14 +02:00
Ricardo Weir dfcaeab10d Add to README 2023-03-31 15:29:35 -07:00
Ricardo Weir 5e907eb105 Add docs for controller package 2022-05-17 17:51:42 -07:00
Ricardo Weir 5492937d69 Add option to only enqueue if actually updated
This option causes the handle function to only proceed if the
object was actually updated. This is intended to be used by
applications with many objects and/or controllers types that
have alternative means of rerunning when necessary. When the
informer's resync their cache the update function is run.
This reducing the overhead but has the tradeoff of not
rerunning handlers that may rely on external objects or
services or experience a bug causing them to not retry even
if it was necessary. The result is that running the handler
func on resync will mostly only serve the purpose of catching
missed cache events.
2022-05-17 17:51:39 -07:00
Ricardo Weir 6bec1c42ea Add metrics 2022-02-15 16:07:42 -07:00
Jacie b241bd94ec fix gouroutine leak when sharedcontroller has been started 2022-01-10 08:46:51 +08:00
Dan Ramich 290d1f010b Drop bucket rate limiter 2021-05-25 16:36:26 -06:00
Dan Ramich b4294eb8b7 Add a max timeout bucket 2021-05-24 10:49:56 -06:00
Darren Shepherd 202b992227 Reduce max backoff to 2 minutes 2021-05-12 14:00:11 -07:00
Kinara Shah 785b05b9a7 don't rate limit key when registering handlers
Problem:
EnqueueKey rate limits the key and is called by sharedcontroller's RegisterHandler.
This is an issue because on startup we start enqueuing each key for each handler, causing the rate limit duration spike to hours very quickly.

Solution:
Adding the key to workqueue directly in EnqueueKey. This is what 2.4.x did as well,
https://github.com/rancher/norman/blob/release/v2.4/controller/generic_controller.go#L187
2021-04-08 16:06:03 -07:00
Darren Shepherd 0a141fe42c Properly handle tombstones 2021-02-10 16:27:36 -07:00
Darren Shepherd fff0364fb3 Don't nil the workqueue on shutdown
When shutdown is called the queue consumer could still be processing
items so don't set the workqueue to nil.  There is no reason to
nil the workqueue as there is no way to restart a controller.
It most be thrown away and a new one created.
2020-08-07 16:13:17 -07:00
Darren Shepherd 8079eb2290 Refactor to allow mode that does not require RESTMapper to be invoked 2020-05-15 08:52:39 -07:00
Darren Shepherd e0509f89f3 Don't require type to exist in k8s until controllers are started 2020-04-27 10:17:00 -07:00
Darren Shepherd 6cfd718cfe Initial Commit 2020-04-15 02:14:08 -07:00