-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Conflicting information about custom resource conversions #27534
Comments
The difference is that the persisted object is not changed no matter what version of its API you use to read it. That's what the second quote is about. If you have a persisted object and try to use a different version of that API to read or modify it, then the API server must convert its representation the persisted object to the API version that the client asked for. That's might involve a webhook for a CRD, as the first quote explains. GitHub (this website) does something similar. This issue is #27534 in https://github.com/kubernetes/website/ no matter which API you use to access it. If GitHub adds a new kind of API for accessing issues, they might choose not to replace all their stored data; instead, they keep storing the data they have and convert on-the-fly when you access it. I think the pages are accurate. It's a difficult concept to explain well and if you have suggestions for improving the explanation (without changing the technical meaning), we'd be keen to hear them. /remove-kind bug PS Using “persisted” vs “stored” consistently could be a useful cleanup - perhaps for a separate issue. |
BTW, the reason that the two objects in https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#writing-reading-and-updating-versioned-customresourcedefinition-objects differ only by the API version is because that was the only change you made. In Kubernetes, the convention when promoting an API to stable (taking |
@sftim thanks for the fast response!
Thank you for clarification, what you now described matches my understanding.
I think the confusing part was this:
I'm guessing this is indeed the case when I re-read the second quote and now that I have your clarification I admit it makes sense, if one assumes that the schema for the two versions is the same, as you say:
Indeed the example that follows ("To illustrate this ...", changing I think there are two ways to improve the situation:
I think the latter option would be much more informative, however I lack knowledge about what happens in the middle case. If someone could chime in with a link to the relevant place in the code, I'd be more than happy to send a doc improvement PR! |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
also |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale
|
@porridge in light of the discussion so far, would you be willing to revise the issue description to outline the defect you see or the improvement you'd like made? |
@sftim finally had some time to reword the issue description. Please take a look and if this makes sense I can propose a patch and file the additional issues. |
Thanks |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
@sftim When working on a PR to address this issue, I tried to find some documentation in https://github.com/kubernetes/community/tree/master/contributors/devel/sig-architecture to back the following claim:
but did not find anything concrete. Do you know if this goal is actually written down somewhere, or is this tribal knowledge? |
That's not a policy, it's an observation. SIG Architecture might have an opinion to add here that it's also an aim of the Kubernetes project. /sig architecture |
This is a Bug Report
Problem:
One part of the "Versions in CustomResourceDefinitions" document says that conversion is performed from storage version to served version. Another says it's not (and furthermore, that k8s will lie about
apiVersion
by setting it without actually making any attempt at schema conversion).Specifically:
The above sentence is not true in general. Specifically because the part:
blurs the distinction between the "persisted object" (which indeed never changes on reads) and the served representation (which definitely is converted, if only to change the apiVersion string), this sentence could be read in two ways:
This first interpretation is only correct if the schemas do not differ. A casual reader of a general document on conversion webhooks certainly dos not have this assumption, and definitely not before reading the example which follows the above sentence.
This second interpretation is just plain wrong. The on-disk object does not change. Period.
Then later, there is an example which describes a special case of serving a
v1
representation of an object persisted atv1beta1
version:This sentence is correct, and in this particular context the first sentence makes more sense (but is still blurry).
Proposed Solution:
vXbetaY
->vX
case.Page to Update:
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning
The text was updated successfully, but these errors were encountered: