Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix status subresource getting updated on Update when it is empty #2484

Merged
merged 1 commit into from Sep 9, 2023

Conversation

alvaroaleman
Copy link
Member

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.

Fixes #2478

/cherrypick release-0.16

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.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 9, 2023
@k8s-ci-robot
Copy link
Contributor

[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

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 k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 9, 2023
@troy0820
Copy link
Member

troy0820 commented Sep 9, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2023
@alvaroaleman
Copy link
Member Author

Interesting, the bot doesn't pick up cherrypick commands from the PR description
/cherrypick release-0.16

@k8s-infra-cherrypick-robot

@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.

In response to this:

Interesting, the bot doesn't pick up cherrypick commands from the PR description
/cherrypick release-0.16

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.

@k8s-ci-robot k8s-ci-robot merged commit 9dd4fc7 into main Sep 9, 2023
9 checks passed
@k8s-infra-cherrypick-robot

@alvaroaleman: new pull request created: #2485

In response to this:

Interesting, the bot doesn't pick up cherrypick commands from the PR description
/cherrypick release-0.16

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.

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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The fake client.Update() updates the status fields
4 participants