-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Field-level versioning #34508
Comments
Some people who might be interested in this: @bgrant0607 @smarterclayton @mbohlool @thockin |
@lavalamp I assume this approach would not allow the same field name to be used at different stages with different types. I was thinking we'd use the tags to specify finer-grain versions, either API minor/patch versions or releases. |
I don't understand this proposal. What do those versions mean? What On Mon, Oct 10, 2016 at 7:44 PM, Brian Grant notifications@github.com
|
@thockin I asked @lavalamp to keep it short. I'll write up more tomorrow. Imagine we had actual distinct API versions containing the alpha, beta, and GA fields corresponding to some feature. They could all use the same internal rep, clients could request the API version containing the version of the field they understood, and users could use Now assuming we don't really want to do that, how could we accomplish the equivalent in a single types.go file? Ignoring whether we use comments or tags or something else to specify information on the fields, we'd put the fields in the same versioned types.go:
Only the most mature version of the field would be serialized in etcd and only one of these fields would be visible to any client at a time. @lavalamp proposed we use the proposal from #33900 to enable the client to request the desired field version. Another possibility is that we use the existing API version mechanism, using the apiVersion field and path. With multiple different fields as above, rather than @lavalamp's syntax for specifying the level of maturity, I'd just specify the maturity level (alpha/beta/GA) of the field (e.g., so we could disable all alpha fields by default) and the range of "versions" that it was at that level of maturity. If we used an extension of the existing API version mechanism, I'd add minor version, such as |
Note that relying on a new mechanism, such as #33900, won't work for any existing clients. |
One disadvantage of using release versions is that some projects that embed K8s (e.g., Openshift) have their own release numbers. Anyway, I'm inclined to use a single versioning scheme for the API. |
It wasn't clear from my initial post, but these were intended to be api versions, not release versions. The patch version will rapidly diverge from the release patch version. We could make this more obvious, by prefixing with something other than "v". We could also not use semver and just have a clock that counts up with each api change--I didn't recommend that because we probably should produce semvers at some point, and it is easiest if we just keep them in that format to begin with. |
Right, you have to actually make a separate "real" api version for that. (Arguably this is a feature.) |
My suggestion is a superset of this. I was thinking you need to know what semantics the client is expecting to get, that it doesn't matter if the server has moved on. I'll have to think about it more, but I still think it is better to track the history and not just the current status. |
You can specify multiple versions in Accept headers. I'm not sure a range really gets you any benefit over that, unless you want to specify it separately and have it apply to all the things in the Accept header. (to avoid combinatorial explosion) |
These provide an API history, and if a client gives a range or a version, we'd know:
The most recent alpha/beta/stable/marker determines the current state of the field. We can then stuff e.g. alpha fields into the list of alpha features automatically and allow them to be toggled on and off.
Swagger:
Conversion:
Update:
Validation:
Defaulting:
This proposal doesn't overlap them from the perspective of the server. Each field is one of alpha, beta, or stable in any given fully specified version number. |
@lavalamp I think we need a mechanism that does permit the representation to change. Otherwise we really are introducing hoops for no good reason. The reason for ranges was to support multiple fields for the same feature, which is needed in order to support representation changes. The specification of maturity of the field similarly assumed there would be multiple fields, so it would capture history, not just current status. I know you weren't proposing we use release versions, but was just pointing out that alternative. I agree on semver. |
I suppose differing representations could be handled by allowing fields On Tue, Oct 11, 2016 at 2:08 PM, Brian Grant notifications@github.com
|
I think having json names that reflect the particular state and If we are backwards compatible in major versions, why not simply
All users eventually have to change beta to GA, which is not a magic For existing GA objects, why have beta fields at all? Why not say |
Added this to the agenda for today's API Machinery SIG. |
A couple questions:
|
|
As I recall, that was actually pitched as a benefit of not adding an |
On the plus side, it does mean we can use some great GIFs... More seriously, to clarify (also left a comment as such on the above community PR): If we're working with a new alpha field That seems like it's going to cause a decent amount of redundant or strange-looking API names... |
- github noreply
…On Tue, Aug 1, 2017 at 10:20 AM, Michael Taufen ***@***.***> wrote:
>If the field dies in alpha, that field name cannot be reused in the
future.
Do we have a test for blacklisting previously-used field names?
On Tue, Aug 1, 2017 at 8:50 AM, Jordan Liggitt ***@***.***>
wrote:
> tl;dr from the alpha fields doc/discussion, any corrections from
> sig-api-machinery are welcome:
>
> 1. use real, omitempty, optional fields for alpha fields
> 2. use the field names you intend to use if the feature progresses
> from alpha->beta->ga (don't put "alpha" in the field name, etc)
> 3. disable the API from accepting or persisting values in those
> fields by default (disabled alpha feature gate checked in validation for
> now, ideally a "field gates" mechanism in the future)
>
> If the field progresses to beta/ga, simply enable the feature gate, and
> no data migration is needed.
>
> If the field dies in alpha, that field name cannot be reused in the
> future.
>
> If the schema of the field changes in an incompatible way, you have to
> choose a new field name.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#34508 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AA3JweMiyyMAPiUAdBmMuawbeOjSSCdtks5sT0lVgaJpZM4KTGnt>
> .
>
--
Michael Taufen
MTV SWE
--
Michael Taufen
Google SWE
|
Automatic merge from submit-queue Update alpha field guidance Summarizing outcome of discussions with @kubernetes/sig-api-machinery-misc ref: * https://docs.google.com/document/d/1wuoSqHkeT51mQQ7dIFhUKrdi3-1wbKrNWeIL4cKb9zU/edit# * kubernetes/kubernetes#34508 (comment) * https://www.youtube.com/watch?v=bzSK00TxEx0&list=PL69nYSiGNLP21oW3hbLyjjj4XhrwKxH2R&index=4&t=2580 (43:00-59:00) * kubernetes/kubernetes#30819
@DirectXMan12 That's my main concern. I can buy that beta fields should not be renamed, so beta -> GA is smooth, but I suspect alpha fields will have a lower success rate. I guess we'll wait and see. Additionally, there's no indication that you're using a beta field, which I dislike. But alas, there are not enough hours in the week to hold strong opinions on everything, so I put my trust in the SIG. |
/cc @ncdc |
[MILESTONENOTIFIER] Milestone Labels Complete Issue label settings:
|
@lavalamp @ncdc @thockin @timothysc @liggitt Is there anything else we need to do for 1.8 here? Can we please move the milestone if not? (or close the issue) |
@lavalamp @ncdc @thockin @timothysc @liggitt this is a daily and friendly ping from release team. Is this still relevant to 1.8? If yes, who is actively working on it? |
Removing from milestone. |
👍 |
/lifecycle frozen |
/remove-kind design
|
/sig architecture |
We have difficulties around moving fields through alpha, beta, GA. #30819 is one idea. I was talking with Brian earlier today and here is a sketch of something that we could do to solve the general problem.
We begin following semver for our api versions, adding a "patch" version. We define a new tag which can be added in a comment before a field, like this:
// +version:alpha=v1.5.3
When the field goes to beta (assuming it doesn't change):
// +version:alpha=v1.5.3,beta=v1.5.89
And at GA the field goes like this:
// +version:alpha=v1.5.3,beta=v1.5.89,stable=v1.5.183
If at any point in time the field is deleted (or moved and we don't want to autoconvert), and clients referencing the field might still exist, we can say:
// +version:alpha=v1.5.3,deleted=v1.5.8
The conversion machinery would enforce that any given version number is only used once (we can store the next version in a file somewhere for human convenience). This complete version should be tracked per-apiserver. (So federation-apiserver would likely have a different patch version.)
We'd use the same idea behind @smarterclayton's #33900 to allow clients to specify which minor version of the api they're intending to use, via
Accept:
headers.Conversion routines, validators, swagger generation etc all need to be made to accept a full api version from clients and they can use the hints on the fields to tell whether the client knows about the field or not. Swagger can report whether fields are alpha or beta.
Likewise we can use the alpha/beta distinction to give admins the ability to disallow alpha or only allow stable fields to be used. (We can construct versions like v1.5.35-stable for this purpose)
The text was updated successfully, but these errors were encountered: