-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
emit warning on deprecated annotation volume.beta.kubernetes.io/storage-class #117036
emit warning on deprecated annotation volume.beta.kubernetes.io/storage-class #117036
Conversation
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Fri Mar 31 04:32:14 UTC 2023. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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/test-infra repository. |
Hi @haoruan. 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/test-infra repository. |
/sig storage |
/lgtm I think this is quite needed because we have seen users still use this long deprecated APIs. |
LGTM label has been added. Git tree hash: 2c00dfbb6c9931111127461290602ea31f7e01e4
|
pkg/api/persistentvolume/util.go
Outdated
func GetWarningsForStorageClassAnnotations(fieldPath *field.Path, meta *metav1.ObjectMeta) []string { | ||
var warnings []string | ||
|
||
if meta.Annotations != nil { |
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.
no need for the nil check, a nil map returns false for lookups
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.
fixed
pkg/api/persistentvolume/util.go
Outdated
return warningsForPersistentVolumeSpecAndMeta(nil, &pv.Spec, &pv.ObjectMeta) | ||
} | ||
|
||
func GetWarningsForStorageClassAnnotations(fieldPath *field.Path, meta *metav1.ObjectMeta) []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.
exporting a method from the persistentvolume package and reusing it from the persistentvolumeclaim package is a little weird... I would probably just replicate/inline the annotation check and warning in warningsForPersistentVolumeSpecAndMeta
and GetWarningsForPersistentVolumeClaim
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.
The reason I add the exported function is because maybe we need it somewhere else, but I didn't find a suitable pkg to add it.
Yes it's a little weird, so let's remove exported method and add to both functions
pkg/api/persistentvolume/util.go
Outdated
fmt.Sprintf( | ||
"%s: %s is %s", | ||
fieldPath.Child("metadata", "annotations"), | ||
api.BetaStorageClassAnnotation, | ||
deprecatedStorageClassAnnotationsMsg, | ||
), |
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.
fmt.Sprintf( | |
"%s: %s is %s", | |
fieldPath.Child("metadata", "annotations"), | |
api.BetaStorageClassAnnotation, | |
deprecatedStorageClassAnnotationsMsg, | |
), | |
fmt.Sprintf( | |
"%s: %s", | |
fieldPath.Child("metadata", "annotations").Key(api.BetaStorageClassAnnotation), | |
deprecatedStorageClassAnnotationsMsg, | |
), |
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.
updated
a95b714
to
19ae103
Compare
/lgtm |
/ok-to-test |
LGTM label has been added. Git tree hash: ebc9401f71088e58a8913873911bc234d5eb1e34
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haoruan, liggitt 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 |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The annotation
volume.beta.kubernetes.io/storage-class
is long deprecated #53580, but with no warning message.Before we stop honoring it, a warning message should be added
Which issue(s) this PR fixes:
Fixes part of #116336
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: