Conversation
|
@alvaroaleman: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Hi @alvaroaleman. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| if logger := c.logger.Desugar(); logger.Core().Enabled(zapcore.DebugLevel) { | ||
| logger.Debug(fmt.Sprintf("Adding to the slow queue %s (depth(total/slow): %d/%d)", | ||
| safeKey(key), c.workQueue.Len(), c.workQueue.SlowLen()), | ||
| logger.Debug(fmt.Sprintf("Adding to the slow queue %s (depth: %d)", |
There was a problem hiding this comment.
Not being able to log the lenght of the slow queue is the one behavioral change we can not avoid
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/kind cleanup |
This change replaces the two lane queue with a small wrapper around the controller-runtime priorityqueue. Having a single queue for both guarantees correct deduplication and avoid metrics issues like describes in knative#3253. It is also much simpler. Signed-off-by: Alvaro Aleman <alvaroaleman@noreply.com>
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
dprotaso
left a comment
There was a problem hiding this comment.
The single-queue approach makes sense, but I found three compatibility regressions introduced by this PR that should be addressed before merging (inline below).
Validation: go test ./controller on this PR head fails in the TestEnqueue subtests because they drain after shutdown; TestEnqueueAfter also fails and then panics on double shutdown. I separately reproduced the retained-backlog shutdown hang and the metrics registration side effects.
Please replace, rather than simply delete, two_lane_queue_test.go, retaining coverage for fast/slow ordering, priority promotion, cross-lane deduplication, in-flight exclusion, rate limiting, and shutdown compatibility.
| fastChan: make(chan any), | ||
| slowChan: make(chan any), | ||
| return &twoLaneRateLimitingQueue{ | ||
| PriorityQueue: priorityqueue.New[any](name, func(o *priorityqueue.Opts[any]) { |
There was a problem hiding this comment.
[P1] Preserve or update the controller's shutdown/draining contract.
RunContext still calls c.workQueue.ShutDown() and then waits until c.workQueue.Len() == 0. Unlike the previous queue, this priority queue immediately stops handing out items after shutdown but retains ready items in its tree. Any remaining ready backlog therefore makes RunContext wait forever, even after active reconciles finish.
I reproduced this on the PR head: after cancellation, ShuttingDown() was true, Len() remained 1, and Get() returned shutdown.
Please either update RunContext to match non-draining shutdown semantics or preserve draining in the wrapper. Switching to ShutDownWithDrain alone does not fix it: this implementation just calls ShutDown.
|
|
||
| "k8s.io/client-go/util/workqueue" | ||
| "k8s.io/utils/clock" | ||
| "sigs.k8s.io/controller-runtime/pkg/controller/priorityqueue" |
There was a problem hiding this comment.
[P1] The new import prevents Knative's global metrics providers from registering.
Importing priorityqueue transitively runs controller-runtime initialization hooks that call workqueue.SetProvider(...) and client-go metrics.Register(...). Both APIs accept only the first call, so these init-time registrations win before injection/sharedmain/main.go registers Knative's OpenTelemetry providers.
Passing globalMetricsProvider explicitly below preserves metrics for this particular controller queue, but does not prevent the global side effects: REST request latency remains a no-op, REST request counts go to controller-runtime's separate Prometheus registry, and other workqueues relying on the global provider use that registry rather than Knative's provider.
A standalone reproduction importing knative.dev/pkg/controller confirmed that subsequent client metric registration had no effect and a custom global workqueue provider was never called. Please use an implementation/version without these registration side effects, or resolve the metrics integration explicitly.
| type twoLaneRateLimitingQueue struct { | ||
| q *twoLaneQueue | ||
| workqueue.TypedRateLimitingInterface[any] | ||
| priorityqueue.PriorityQueue[any] |
There was a problem hiding this comment.
[P2] Keep shutdown idempotent in the compatibility wrapper.
The old workqueue's ShutDown() was idempotent. The embedded replacement unconditionally calls close(w.done), so a second shutdown panics with close of closed channel. This already happens in TestEnqueueAfter, which shuts down explicitly and again in cleanup. Callers can also explicitly stop the exposed workqueue before RunContext performs its deferred shutdown.
Please guard shutdown with sync.Once (or equivalent), routing both ShutDown and ShutDownWithDrain through the same guard.
|
/ok-to-test |
This change replaces the two lane queue with a small wrapper around the controller-runtime priorityqueue. Having a single queue for both guarantees correct deduplication and avoid metrics issues like describes in #3253. It is also much simpler.
/assign @dprotaso
Changes
/kind
Fixes #
Release Note
Docs