Skip to content

Add warnings for use of Alpha features with Emulated Version #132276

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaelasp
Copy link
Contributor

@michaelasp michaelasp commented Jun 12, 2025

Warn for both api and feature flag use of alpha features with emulated versions. This is an unsupported use case and users may run into issues.

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds warnings on using Alpha features with compatibility version, since it is not a supported feature.

Which issue(s) this PR is related to:

Fixes #128502

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add warning on use of alpha metrics with emulated versions.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 12, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @michaelasp. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 12, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: michaelasp
Once this PR has been reviewed and has the lgtm label, please assign jpbetz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@michaelasp
Copy link
Contributor Author

/cc @Jefftree

@k8s-ci-robot k8s-ci-robot requested a review from Jefftree June 12, 2025 22:37
if binaryVersion.GreaterThan(emulatedVersion) {
// Warn on alpha features being enabled when using emulated version.
for feat, featSpec := range features {
if featSpec.PreRelease == featuregate.Alpha {
Copy link
Member

Choose a reason for hiding this comment

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

Are these only the enabled feature gates? Feature gate could exist and be turned off right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, this is all features. I made it so that only the enabled features are warned. PTAL!

if c.EffectiveVersion.BinaryVersion() != c.EffectiveVersion.EmulationVersion() {
for _, version := range registry.PrioritizedVersionsAllGroups() {
if strings.Contains(version.Version, "alpha") {
klog.Warning("alpha api enabled with emulated version, this is unsupported, proceed at your own risk: api=", version.String())
Copy link
Member

Choose a reason for hiding this comment

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

nit: version is a group-version object. gv or groupVersion would be more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added groupversion :)

@Jefftree
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 17, 2025
@yongruilin
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 17, 2025
@Jefftree
Copy link
Member

@michaelasp Is there any testing we can do to verify this behavior? Otherwise lgtm.

@michaelasp
Copy link
Contributor Author

@michaelasp Is there any testing we can do to verify this behavior? Otherwise lgtm.

I'll see if it's possible to create some helper function we can unit test. The issue is that this is all logging so there's no explicit behavior change we can test. Let me try testing a helper.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 26, 2025
@michaelasp
Copy link
Contributor Author

michaelasp commented Jun 26, 2025

Added testing for feature gate since it's a bit more involved. I think that moving the api_enablement into a helper would just make this more difficult to understand since it's just checking whether alpha exists in the GVK. I can move it into a helper if we want but i'm not sure how much value the test adds in that case. PTAL @Jefftree!

Warn for both api and feature flag use of alpha features with emulated versions. This is an unsupported use case and users may run into issues.

Signed-off-by: Michael Aspinwall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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/architecture Categorizes an issue or PR as relevant to SIG Architecture. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Compatibility Version] alphas with emulated version
4 participants