refactor: replace deprecated Result.Requeue in controller reconcilers - #1346
Closed
christian-heusel wants to merge 2 commits into
Closed
refactor: replace deprecated Result.Requeue in controller reconcilers#1346christian-heusel wants to merge 2 commits into
christian-heusel wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Bump k8s.io libraries, controller-runtime, istio.io/api and istio.io/client-go, and their transitive deps, to match the versions used in workspaces/backend. Also switch NewWebhookManagedBy/admission.Validator usage in workspace_webhook.go and workspacekind_webhook.go to the typed API instead of manually type-asserting runtime.Object. Regenerate the WorkspaceKind CRD for new upstream corev1 fields. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Christian Heusel <christian@heusel.eu>
controller-runtime deprecates Result.Requeue in favor of RequeueAfter / returning an error (see the v0.24.1 field docs). The dependency bump in kubeflow#1306 moves the controller to a version where staticcheck flags every usage as SA1019, so this proactively removes them (the change is valid on the current controller-runtime v0.19.1 too). This replaces every usage in the controller reconcilers: - Conflict-retry sites now return the conflict error so the workqueue rate-limiter handles retry-on-error (its documented purpose), which preserves the same rate-limited backoff that Requeue: true provided. - Stale-cache sites (ServiceAccount not yet in the cache) rely on the Owns(ServiceAccount) watch to requeue, matching the existing comments. - mergeReconcileResult drops its .Requeue handling and now merges purely on RequeueAfter; its unit test is updated accordingly. Tradeoff for discussion: conflict errors are now surfaced by controller-runtime at error level rather than staying quiet at V(2). Assisted-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Christian Heusel <christian@heusel.eu>
christian-heusel
force-pushed
the
chore/fix-requeue-deprecation
branch
from
August 23, 2026 11:58
977f178 to
700cdec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / Why
controller-runtimedeprecatesreconcile.Result.Requeuein favor ofRequeueAfter/ returning an error. The dependency bump in #1306 moves the controller tocontroller-runtime v0.24.1, wherestaticcheckflags everyResult{Requeue: true}usage asSA1019:This PR removes all 16 usages in the controller reconcilers. The change is valid on the current
v0.19.1too, so it can land independently of #1306.Commit layout
chore: bump Go dependencies in controller— a temporary cherry-pick of the controller dependency bump from chore: Bump golang dependencies in backend & controller #1306, included here only so this PR's CI exercisescontroller-runtime v0.24.1, i.e. a version whereResult.Requeueis actually deprecated andstaticcheckflags it. It is identical to the commit in chore: Bump golang dependencies in backend & controller #1306 and will drop out on rebase once chore: Bump golang dependencies in backend & controller #1306 merges intonotebooks-v2.refactor: replace deprecated Result.Requeue …— the actual change under review.Please review the second commit; the first is scaffolding.
Approach
The reconciler used
Requeue: truein two distinct situations, handled differently:IsConflict(err)retry after an updatereturn Result{Requeue: true}, nilreturn Result{}, errreturn Result{Requeue: true}, nilreturn Result{}, nilOwns(&ServiceAccount{}), so the owned-object watch will requeue us — the existing code comments already say so. No explicit requeue needed.mergeReconcileResult()no longer inspects the deprecated.Requeuefield and merges purely onRequeueAfter; its unit test was updated to match.Options considered
Requeue: trueRequeueAfter: <small const>nil)//nolint:staticcheck🗣️ Discussion points
V(2)and returned asnil— now surface via controller-runtime's"Reconciler error"at error level (and bump the error metric). Is that acceptable, or do we prefer option B (RequeueAfter) to keep conflicts quiet at the cost of changing the retry cadence?Owns(&ServiceAccount{})watch to requeue acceptable, or would you rather keep an explicit shortRequeueAfteras a safety net?k8s.io/apimachinery/pkg/util/httpstream→k8s.io/streaming/pkg/httpstream(the otherSA1019the bump surfaces), or keep that as a separate PR?related: #1306