Repository navigation
feat(client)!: write the status with server-side apply - #1354
Merged
Merged
Conversation
UpdateStatusAsync replaced the status with a PUT that carried the resourceVersion and failed with 409 Conflict whenever the resource had changed, e.g. its spec. It now sends apiVersion, kind, name, namespace and the status as a server-side apply to the /status subresource, without the resourceVersion and with force, as recommended for controllers. It uses the field manager of the client; an operator sets it. BREAKING CHANGE: UpdateStatusAsync no longer fails with 409 Conflict on an outdated entity, and it needs a field manager. A KubernetesClient outside an operator that writes the status has to be created with one, e.g. new KubernetesClient(config, "my-tool").
|
🎉 This PR is included in version 15.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Dec 2, 2026
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.
Summary
UpdateStatusAsyncreplaced the status with aPUT. The request carried theresourceVersionand failed with409 Conflictwhenever the resource had changed in the meantime, e.g. its spec, and the field manager owned the whole status.UpdateStatusAsyncnow writes the status with server-side apply, without a new method:apiVersion,kind,metadata.name,metadata.namespace(if any) andstatus, and goes to the/statussubresource.resourceVersion, so an outdated entity no longer fails with 409. The spec and the status fields that are not sent stay as they are.force: true, as the Kubernetes docs recommend for controllers ("It is strongly recommended for controllers to always force conflicts on objects that they own and manage"). Without it, the first write after the upgrade would conflict with the operator's ownUpdateentry from thePUT.FieldManagerHandlerof the operator, or the one passed tonew KubernetesClient(config, fieldManager). There is no fallback; without a field manager the API server rejects the apply.Supersedes #1351, which added
PatchStatusAsyncoverloads instead.Breaking change
UpdateStatusAsyncno longer fails with 409 on an outdated entity.IKubernetesnothing changes; an ownIKubernetesneeds theFieldManagerHandler(already documented since 14.1); aKubernetesClientoutside an operator needs to be created with a field manager.Updateentry of thePUTuntil they are sent again.All documented in
migration.mdx(v15).Tests
KubernetesClient.UpdateStatus.Test.cs: path with?force=true,application/apply-patch+yaml, and the apply configuration for namespaced and cluster-scoped entities.KubernetesClient.FieldManager.Test.cs: the status write is now aPATCHwith the field manager.KubernetesClient.UpdateStatus.Integration.Test.cs(cluster): an outdated entity is written without 409, the spec change of the other writer is kept, andmanagedFieldsshowsApplyonstatus. Two existing integration tests now use a client with a field manager. Not run locally (no cluster), runs in CI.Docs
migration.mdx,troubleshooting.mdx(409 only forUpdateAsync),field-manager.mdx,KubeOps.KubernetesClientREADME.Reviews
/code-review: the reconcile pipeline already loads the entity fresh before each reconcile and skips a recreated object (EntityQueueBackgroundService), so a stale status is limited to a running reconcile. Documented the upgrade case (fields owned by the oldUpdateentry) and the own-IKubernetescase. Not changed: core group types (/apis//v1/..., pre-existing, tracked in the roadmap); a type with anullstatus applies an empty status./simplifyand/security-reviewby hand: no new type or method; name and namespace are escaped path parameters of the official client, the body is aJsonObject;forceonly affects fields of our own status, and the generated RBAC rule for<plural>/statusalready containspatch.Note:
migration.mdx,field-manager.mdxand the client README are also changed by #1348; whichever merges second needs a small rebase, which I will do.