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

Improve CRD version conversion description #37267

Merged
merged 3 commits into from
Dec 20, 2022

Conversation

porridge
Copy link
Member

  • Use "stored version" consistently, rather than "persisted version"
  • Describe what happens in the general case of stored version != served version.
  • Make an explicit distinction between (conceptually immutable on reads) persisted object and the served representation, rather to try and describe both in one go.
  • Warn that differing schemas without a conversion webhook is not likely to end well.

/cc @sftim

Fixes: #27534

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 11, 2022
@netlify
Copy link

netlify bot commented Oct 11, 2022

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 270c680
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/6399b06c4985c700083abc64
😎 Deploy Preview https://deploy-preview-37267--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@divya-mohan0209
Copy link
Contributor

/sig api-machinery
/wg api-expression

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression. labels Dec 13, 2022
@divya-mohan0209
Copy link
Contributor

@kubernetes/sig-api-machinery-pr-reviews : PTAL and provide a signoff from a technical standpoint.

Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

technical content lgtm, made one suggestion

Comment on lines +1040 to +1042
(depending on the configuration). Note that this is unlikely to lead to good
results if the schemas differ between the storage and requested version.
Copy link
Member

Choose a reason for hiding this comment

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

let's be stronger here... "This strategy should not be used if the same data is represented in different fields between versions."

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better: “You should not use this approach…” (or strategy).

We prefer the active voice in docs.

Copy link
Member

Choose a reason for hiding this comment

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

I should have known the active voice was preferred ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Since "same data is represented in different fields" is strictly speaking a sub-case of "schemas differ", I added this rather than replacing the current sentence. I think it reads well. Let me know if you feel strongly about this.

@porridge
Copy link
Member Author

Comment applied and rebased to a bit fresher base. PTAL

@tengqm
Copy link
Contributor

tengqm commented Dec 18, 2022

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tengqm

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 Dec 18, 2022
@porridge
Copy link
Member Author

Looks like I have an approval but I need an LGTM as well 🤔

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

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

For changes to the live site, we typically don't have the same person LGTM and approve it (there's an exception for trivial fixes). That way, if there's a disagreement, it can happen before the publish.

#37267 (review) is a tech LGTM

/lgtm

Comment on lines 1048 to 1050
If you update an existing object, it is rewritten at the version that is
currently the storage version. This is the only way that objects can change from
one version to another.
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 we should explain what happens if you do a no-op server-side apply change using the stored version of that API (eg stored version is v1, SSA request uses v2 (but a no-op), and the storage version for that API is v2).

Readers might want to know:

  • does the no-op quality of the request mean that the stored version is unchanged?
  • does the storage version change because conversion is required, and a request that causes a write has been admitted
  • does something else affect the outcome here?

Copy link
Member

Choose a reason for hiding this comment

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

The write short-circuit happens at the last minute by comparing the bytes about to be stored against the bytes already stored.

That means a "no-op" update of an object currently stored in v1 but whose CRD has since changed the storage version to v2 will persist an update in v2 format, even if nothing else changed (because the apiVersion: .../v2 bytes would be different).

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

LGTM label has been added.

Git tree hash: 47c470f5597ef6b64a007be18894eb1ab6445ccf

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. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conflicting information about custom resource conversions
6 participants