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

move check for noop managed field timestamp updates #116865

Merged

Conversation

alexzielenski
Copy link
Contributor

@alexzielenski alexzielenski commented Mar 22, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

this check needs to go after any mutations. After the mutating admission chain, rest.BeforeUpdate (which is responsible for reverting updates to immutable timestamp fields, among other things.) is called in the store.Update function. This makes it possible for an object to be written to etcd with only a change to its managed fields timestamp.

This PR moves the check for these noop writes deeper in the handler chain, to the after the last point the object is modified.

Which issue(s) this PR fixes:

Fixes #116861

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixes creationTimestamp: null causing unnecessary writes to etcd

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver area/test sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 22, 2023
this check needs to go after any mutations. After the mutating admission chain, rest.BeforeUpdate (which is responsible for reverting updates to immutable timestamp fields, among other things.) is called in the store.Update function. Without moving this check, it will be possible for an object to be written to etcd with only a change to its managed fields timestamp.
@alexzielenski alexzielenski force-pushed the apiserver/apply/move-transformer branch from 8b584b6 to 2b01f63 Compare March 22, 2023 18:30
@apelisse
Copy link
Member

Fixes #116861

Thanks Alex!
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 22, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2fa81a38143c06dd5e7c93686f462be5feac2ddb

@lavalamp
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexzielenski, apelisse, lavalamp

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 23, 2023
@lavalamp
Copy link
Member

I'm not sure what stage we are in for the release and if it's OK to dump the milestone label on this or not

@enj
Copy link
Member

enj commented Mar 24, 2023

I'm not sure what stage we are in for the release and if it's OK to dump the milestone label on this or not

@kubernetes/release-managers

@saschagrunert
Copy link
Member

I'm not sure what stage we are in for the release and if it's OK to dump the milestone label on this or not

We already released rc.0 yesterday so only exceptional test-fixes should be part of the milestone: https://github.com/kubernetes/sig-release/tree/master/releases/release-1.27#summary

@lavalamp
Copy link
Member

@saschagrunert This is kind of an exceptional bug fix, but also the bug has existed for several releases so we can probably just wait and cherry pick for the .1 release. I will assume the latter is your preference unless you say otherwise.

@cici37
Copy link
Contributor

cici37 commented Mar 28, 2023

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2023
@pacoxu
Copy link
Member

pacoxu commented Apr 12, 2023

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5f23f83 into kubernetes:master Apr 12, 2023
1 check passed
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Apr 12, 2023
@lavalamp
Copy link
Member

@alexzielenski can you back port this please? :)

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Apr 17, 2023
@alexzielenski
Copy link
Contributor Author

/release-note-edit

Fixes creationTimestamp: null triggering unnecessary resource writes

@k8s-ci-robot
Copy link
Contributor

@alexzielenski: /release-note-edit must be used with a release note block.

In response to this:

/release-note-edit

Fixes creationTimestamp: null triggering unnecessary resource writes

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.

@pastequo
Copy link

pastequo commented Jul 26, 2023

@alexzielenski I think your fix wasn't back ported in 1.27

@apelisse @lavalamp Would it possible to have the other cherry pick approved ? I think without this fix, controllers trying to use SSA are creating an infinite reconcile loop (if they are watching the resources they own and not using "unstructured" client)

@liggitt
Copy link
Member

liggitt commented Sep 10, 2023

@alexzielenski @apelisse should this be picked to 1.27, and the 1.26 and 1.25 picks reviewed?

@apelisse
Copy link
Member

apelisse commented Sep 11, 2023

Yeah, absolutely. @alexzielenski would you mind doing it?

k8s-ci-robot added a commit that referenced this pull request Sep 18, 2023
…f-#116865-upstream-release-1.27

Automated cherry pick of #116865: move check for noop managed field timestamp updates
k8s-ci-robot added a commit that referenced this pull request Sep 18, 2023
…f-#116865-upstream-release-1.26

Automated cherry pick of #116865: move check for noop managed field timestamp updates
k8s-ci-robot added a commit that referenced this pull request Sep 18, 2023
…f-#116865-upstream-release-1.25

Automated cherry pick of #116865: move check for noop managed field timestamp updates
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. area/apiserver area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

creationTimestamp: null still causes unnecessary etcd-write with SSA
10 participants