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

Recheck if transformed data is stale when doing live lookup during update #58375

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Jan 17, 2018

Fixes #49565

Caching storage can pass in a cached object to GuaranteedUpdate as a hint for the current object.

If the hint is identical to the data we want to persist, before short-circuiting as a no-op update, we force a live lookup.

We should check two things on the result of that live lookup before short-circuiting as a no-op update:

  1. the bytes we want to persist still match the transformed bytes read from etcd
  2. the state read from etcd didn't report itself as stale. this would mean the transformer used to read the data would not be the transformer used to write it, and "no-op" writes should still be performed, since transformation will make the underlying content actually different.

After a live lookup, we checked byte equality, but not the stale indicator. This meant that key rotation or encrypted->decrypted, and decrypted->encrypted updates are broken.

Introduced in #54780 and picked back to 1.8 in #55294

Fixed encryption key and encryption provider rotation

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 17, 2018
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 Jan 17, 2018
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 17, 2018
@liggitt liggitt added this to the v1.9 milestone Jan 17, 2018
@liggitt liggitt added kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cherrypick-candidate sig/auth Categorizes an issue or PR as relevant to SIG Auth. labels Jan 17, 2018
// this update should write to etcd because the transformer reported stale
err = store.GuaranteedUpdate(ctx, key, out, true, nil,
func(_ runtime.Object, _ storage.ResponseMeta) (runtime.Object, *uint64, error) {
return input, nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

We're using this inline function 3 times here. I'd rather extract it to a function with a meaningful name to make code shorter and self-explained.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a closure, isn't it? Can't extract it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, now I see.

@smarterclayton
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, smarterclayton

Associated issue: #49565

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request Current

@hongchaodeng @liggitt @madhusudancs @smarterclayton

Pull Request Labels
  • sig/api-machinery sig/auth: Pull Request will be escalated to these SIGs if needed.
  • priority/critical-urgent: Never automatically move pull request out of a release milestone; continually escalate to contributor and SIG through all available channels.
  • kind/bug: Fixes a bug discovered during the current release.
Help

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@liggitt
Copy link
Member Author

liggitt commented Jan 17, 2018

/retest

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 4257f75 into kubernetes:master Jan 17, 2018
@liggitt liggitt deleted the decrypt branch January 18, 2018 02:21
k8s-github-robot pushed a commit that referenced this pull request Jan 18, 2018
…5-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #58375: Recheck if transformed data is stale when doing live lookup

Cherry pick of #58375 on release-1.8.

#58375: Recheck if transformed data is stale when doing live lookup
@jennybuckley
Copy link

/cc @jpbetz

@k8s-ci-robot k8s-ci-robot requested a review from jpbetz January 18, 2018 21:10
@RuiGuo34
Copy link

Is this issue fixed for v1.8.4+?

@liggitt
Copy link
Member Author

liggitt commented Jan 24, 2018

This issue was introduced in 1.8.3.

The fix for 1.8.x was merged in #58377 and is pending release.

k8s-github-robot pushed a commit that referenced this pull request Jan 26, 2018
…5-upstream-release-1.9

Automatic merge from submit-queue.

Automated cherry pick of #58375: Recheck if transformed data is stale when doing live lookup

Cherry pick of #58375 on release-1.9.

#58375: Recheck if transformed data is stale when doing live lookup
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.9" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

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. 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. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. 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/auth Categorizes an issue or PR as relevant to SIG Auth. 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.

10 participants