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
fix: should not set default storageclass if annotation "volume.beta.kubernetes.io/storage-class" is set #116089
Conversation
Hi @cvvz. 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. |
cc @RomanBednar PTAL, thanks. |
We should also document |
Suggestion for the changelog entry (assuming this is actually a bug): Fixed a bug where Kubernetes would apply a default StorageClass to a PersistentVolumeClaim,
even when the deprecated annotation `volume.beta.kubernetes.io/storage-class` was set. |
BTW https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/#using-dynamic-provisioning covers the deprecation. |
/ok-to-test |
@@ -937,7 +937,7 @@ func (ctrl *PersistentVolumeController) updateVolumePhaseWithEvent(volume *v1.Pe | |||
// Ignores claims that already have a storage class. | |||
// TODO: if resync is ever changed to a larger period, we might need to change how we set the default class on existing unbound claims | |||
func (ctrl *PersistentVolumeController) assignDefaultStorageClass(claim *v1.PersistentVolumeClaim) (bool, error) { | |||
if claim.Spec.StorageClassName != nil { | |||
if storagehelpers.GetPersistentVolumeClaimClass(claim) != "" { |
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.
Can you add a unit test for the fix?
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.
Sure, added.
/retest |
/lgtm |
LGTM label has been added. Git tree hash: 19df02ce002d968d125afbbe1c367a932032ac48
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cvvz, msau42 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 |
@cvvz could you cherry-pick to the broken releases? |
@andyzhangx Sure. |
…-origin-release-1.26 Automated cherry pick of #116089: fix: should not set default storageclass if annotation "volume.beta.kubernetes.io/storage-class" is set
…-origin-release-1.25 Automated cherry pick of #116089: fix: should not set default storageclass if annotation "volume.beta.kubernetes.io/storage-class" is set
What type of PR is this?
/kind bug
What this PR does / why we need it:
No need to set default storageclass if annotation "volume.beta.kubernetes.io/storage-class" is set
Which issue(s) this PR fixes:
Fixes #116028
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: