🐛 Fix status subresource getting updated on Update when it is empty#2484
🐛 Fix status subresource getting updated on Update when it is empty#2484k8s-ci-robot merged 1 commit intomainfrom
Conversation
Before this, Update and Patch requests will override to-level status fields for objects that have a status resource if the status was initially empty. This happens because the code to set the status to what we already have in the unupdated object converts the object into a `map[string]any` using json serialization/deserialization, copies the original `status` field, then converts back. The json deserializer unfortunatelly does not properly clear the target, allowing data to remain that is absent in the json serialization.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
|
Interesting, the bot doesn't pick up cherrypick commands from the PR description |
|
@alvaroaleman: once the present PR merges, I will cherry-pick it on top of release-0.16 in a new PR and assign it to you. 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/test-infra repository. |
|
@alvaroaleman: new pull request created: #2485 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/test-infra repository. |
Before this, Update and Patch requests will override to-level status fields for objects that have a status resource if the status was initially empty.
This happens because the code to set the status to what we already have in the unupdated object converts the object into a
map[string]anyusing json serialization/deserialization, copies the originalstatusfield, then converts back. The json deserializer unfortunatelly does not properly clear the target, allowing data to remain that is absent in the json serialization.Fixes #2478
/cherrypick release-0.16