Skip to content

🐛 Fix regression in Apply typed error handling#3515

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
erikgb:fix-apply-error-handling
May 11, 2026
Merged

🐛 Fix regression in Apply typed error handling#3515
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
erikgb:fix-apply-error-handling

Conversation

@erikgb

@erikgb erikgb commented May 8, 2026

Copy link
Copy Markdown
Member

When attempting to upgrade K8s dependencies in multiple operators, I noticed what seems to be a regression in the error handling for the Apply method in the controller-runtime client. Sadly, only one of the operators I've been having issues with is open source, but the problem can be observed in the failing CI of statnett/image-scanner-operator#1729. This operator contains compensating logic for the RequestEntityTooLarge error (HTTP status 413), which is broken after upgrading K8s deps (including controller-runtime).

In one of our closed-source operators, I observe a similar issue, which is likely to be related. There we have compensating logic if trying to modify an immutable field. The tests are failing for the upgrade PR with the following logged inside the operator:

{"level":"error","ts":"2026-05-04T08:50:50Z","msg":"Reconciler error","controller":"application","controllerGroup":"stas.statnett.no","controllerKind":"Application","Application":{"name":"v1beta2-immutable-field","namespace":"application-operator"},"namespace":"application-operator","name":"v1beta2-immutable-field","reconcileID":"45487740-546a-427e-a4d4-f826bf4042eb","error":"the server rejected our request due to an error in our request (patch deployments.apps v1beta2-immutable-field)","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.24.0/pkg/internal/controller/controller.go:494\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.24.0/pkg/internal/controller/controller.go:437\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func1.1\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.24.0/pkg/internal/controller/controller.go:312"}

I believe the regression was introduced in #3475, which represents a good improvement/feature. But I think the error handling was dramatically changed by the PR.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 8, 2026
@k8s-ci-robot k8s-ci-robot requested review from JoelSpeed and vincepri May 8, 2026 09:57
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 8, 2026
Comment thread pkg/client/client_test.go Outdated
@erikgb erikgb force-pushed the fix-apply-error-handling branch from a30487e to 729377b Compare May 8, 2026 14:48
@erikgb erikgb changed the title WIP: 🐛 Fix regression in Apply typed error handling 🐛 Fix regression in Apply typed error handling May 8, 2026
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2026
@erikgb erikgb force-pushed the fix-apply-error-handling branch from 729377b to a51b34c Compare May 8, 2026 14:51
Comment thread pkg/client/typed_client.go Outdated
@erikgb erikgb force-pushed the fix-apply-error-handling branch from a51b34c to 41f79d1 Compare May 8, 2026 14:59
@erikgb erikgb requested review from alvaroaleman and sbueringer May 11, 2026 08:40
Comment thread pkg/client/client_test.go Outdated
@alvaroaleman

Copy link
Copy Markdown
Member

/cherrypick release-0.24

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@alvaroaleman: once the present PR merges, I will cherry-pick it on top of release-0.24 in a new PR and assign it to you.

Details

In response to this:

/cherrypick release-0.24

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.

Signed-off-by: Erik Godding Boye <egboye@gmail.com>
@erikgb erikgb force-pushed the fix-apply-error-handling branch from 41f79d1 to a500bff Compare May 11, 2026 17:39
@erikgb erikgb requested a review from alvaroaleman May 11, 2026 17:40

@alvaroaleman alvaroaleman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, erikgb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 83924df9874c60a1dbe24c5d945843955c99816f

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 11, 2026
@k8s-ci-robot k8s-ci-robot merged commit c2d9fab into kubernetes-sigs:main May 11, 2026
7 checks passed
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@alvaroaleman: new pull request created: #3516

Details

In response to this:

/cherrypick release-0.24

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants