-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
base: master
Are you sure you want to change the base?
Conversation
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 Once the patch is verified, the new status will be reflected by the 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: michaelasp 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 |
/cc @Jefftree |
if binaryVersion.GreaterThan(emulatedVersion) { | ||
// Warn on alpha features being enabled when using emulated version. | ||
for feat, featSpec := range features { | ||
if featSpec.PreRelease == featuregate.Alpha { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added groupversion :)
/ok-to-test |
/triage accepted |
@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. |
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]>
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: