Skip to content

KEP-4330: Change API availability to forward compatibility #5038

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

Merged

Conversation

siyuanfoundation
Copy link
Contributor

@siyuanfoundation siyuanfoundation commented Jan 14, 2025

  • One-line PR description: change api availability to forward compatible to make it easier to handle API graduation in compatibility version.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 14, 2025
@k8s-ci-robot k8s-ci-robot added kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 14, 2025
@siyuanfoundation
Copy link
Contributor Author

siyuanfoundation commented Jan 14, 2025

@siyuanfoundation siyuanfoundation force-pushed the compat-versions-api branch 2 times, most recently from 6abb021 to fbbc5f7 Compare January 14, 2025 05:37
Instead, we are proposing to keep forward compatibility of all AIPs in compatibility version mode:
All APIs group-versions declarations would be modified
to track which Kubernetes version the API group-versions are removed at. APIs introduced between the emulation version and
the binary version are still available if the stability level is no less than the APIs introduced before or at the emulation version and enabled at the emulation version.
Copy link
Member

Choose a reason for hiding this comment

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

Most of this is referring to API enablement/disablement on a group-version level. However, API lifecycles are generally individual on the group-version-resource level. I think it would make more sense to discuss the individual beta->GA resources rather than the entire group version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.


Alpha APIs may not be enabled in conjunction with emulation version.

The forward compatibility of APIs should not affect data compatibility because storage version is still controlled by the `MinCompatibilityVersion` regardless of whether the data are created through future versions of the API endpoints. Webhooks should also work fine if the matching policy is `Equivalent`.
Copy link
Member

@Jefftree Jefftree Jan 14, 2025

Choose a reason for hiding this comment

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

I think we should add a section on how MinCompatibilityVersion will change storage version since the policy has always been n-1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in #5006

to track which Kubernetes version the API group-versions are introduced (or
removed) at.
removed) at. But in practice, that would make code changes of API graduation intractable.
Copy link
Member

Choose a reason for hiding this comment

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

intractable only for withholding API introductions. API removals don't need special handling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the whole section. Please review again see if it is more clear.

@@ -610,21 +623,25 @@ The storage version of each group-resource is the newest

### API availability

Similar to feature flags, all APIs group-versions declarations will be modified
Ideally, similar to feature flags, all APIs group-versions declarations should be modified
Copy link
Member

Choose a reason for hiding this comment

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

Is this referring to the prerelease lifecycle files or a different mechanism? prerelease lifecycle operates on the types instead of the group version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is referring to the the prerelease lifecycle.

Comment on lines 628 to 629
removed) at: if an API is introduced after (or removed before) the emulation version, it should not be available at the emulation version. But in practice, that would make code changes of API graduation that wants to use newer APIs intractable.
For example, if a controller is switching from Beta to GA API at the binary version, a full emulation would mean the whole controller code needs to be
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that we're doing this specifically for controllers. Are there other use cases or should we simplify the wording here and just state up front that we're doing this to support controllers specifically?

the emulation version is set to. I.e. `--runtime-config=api/<version>` needs
to be able to turn on APIs exactly like it did for each Kubernetes version that
emulation version can be set to.
If an API has GAed and has not been removed at the emulated version, it would be enabled by default at the emulation version. If a newer stable version of the GA API has been introduced between the emulation version and the binary version, the new GA API would also be enabled at the emulation version along with the old GA API.
Copy link
Contributor

Choose a reason for hiding this comment

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

A comparison (maybe in a table), or how emulation works for normal APIs vs how it works for un-emulatable (non-emulatable?) features might make this information easier to digest.


GA APIs should match the exact set of APIs enabled in GA for the Kubernetes version
the emulation version is set to.
Instead, we are proposing to keep forward compatibility of all APIs in compatibility version mode:
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 proposing that non-emulatable feature controllers to update to use the newest available API, ignoring emulation API enablement, right? Maybe say this more directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, mainly for controllers for now. May expand to kublet if we want to add compat version in node. Updated the section.

@siyuanfoundation siyuanfoundation force-pushed the compat-versions-api branch 3 times, most recently from f8bce11 to 961b0c9 Compare January 14, 2025 22:39
@siyuanfoundation siyuanfoundation changed the title KEP-4330: Change API availability to forward compatibility and add UnEmulatableFeatures KEP-4330: Change API availability to forward compatibility and add NonEmulatableFeatures Jan 15, 2025

With the `NonEmulatableFeatures` list, the server would fail to start if
1. the `EmulationVersion != BinaryVersion` and
1. any feature in the `NonEmulatableFeatures` list is disabled by default at the emulation version and explicitly enabled by the `--feature-gates` flag.
Copy link
Contributor

Choose a reason for hiding this comment

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

What alternatives were considered here? It's not clear to me WHY we're deciding to refuse to start apiservers that have a non-emulatable beta on vs. allowing the beta to be turned on but not guaranteeing emulation for the feature.

Having the apiserver refuse to start is a potential footgun for anyone with automation that uses emulation version, and also offers the capability to turn on beta features/APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Giving more thoughts to it, I think the alternative is the better way to go. Updated the section with pros and cons.

@siyuanfoundation siyuanfoundation force-pushed the compat-versions-api branch 3 times, most recently from 69475d9 to 32e11d2 Compare January 16, 2025 19:42
@siyuanfoundation siyuanfoundation changed the title KEP-4330: Change API availability to forward compatibility and add NonEmulatableFeatures KEP-4330: Change API availability to forward compatibility Jan 16, 2025
@siyuanfoundation
Copy link
Contributor Author

/cc @deads2k @johnbelamaric

@deads2k
Copy link
Contributor

deads2k commented Feb 3, 2025

With the addition of --emulation-forward-compatible it is possible to match server behavior easily and it is possible to match new beta kube-controller-manager behavior easily. Thanks.

/lgtm

/assign @jpbetz for approval

@k8s-ci-robot
Copy link
Contributor

@deads2k: GitHub didn't allow me to assign the following users: for, approval.

Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

With the addition of --emulation-forward-compatible it is possible to match server behavior easily and it is possible to match new beta kube-controller-manager behavior easily. Thanks.

/lgtm

/assign @jpbetz for approval

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 3, 2025
@jpbetz
Copy link
Contributor

jpbetz commented Feb 4, 2025

/approve

Thanks all for helping to shape this.

@siyuanfoundation
Copy link
Contributor Author

/cc @johnbelamaric @dims for sig-arch approval

@k8s-ci-robot
Copy link
Contributor

@siyuanfoundation: GitHub didn't allow me to request PR reviews from the following users: for, approval.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @johnbelamaric @dims for sig-arch approval

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-sigs/prow repository.

@dims
Copy link
Member

dims commented Feb 4, 2025

cc @liggitt

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 4, 2025
@liggitt
Copy link
Member

liggitt commented Feb 4, 2025

/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 Feb 4, 2025
@dims
Copy link
Member

dims commented Feb 4, 2025

/approve

thanks for the spot check @liggitt

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, jpbetz, liggitt, siyuanfoundation

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 Feb 4, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4360bd9 into kubernetes:master Feb 4, 2025
4 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.33 milestone Feb 4, 2025
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/kep Categorizes KEP tracking issues and PRs modifying the KEP directory lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. 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