-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Fix empty string reclaim policy being considered valid in StorageClass #66682
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
Conversation
@kubernetes/sig-storage-pr-reviews @kubernetes/sig-storage-api-reviews |
/approve |
/lgtm /assign @liggitt |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: childsb, jsafrane, wongma7 If they are not already assigned, you can assign the PR to them by writing 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 |
/hold Tightening validation in a way that causes existing persisted data to be considered invalid is a breaking API change. What is the current behavior of a storage class with |
The current behaviour is that PVs provisioned for the storageclass are created with reclaimPolicy |
A possible approach to improve validation for objects which are fatally flawed is being explored in #64907, but I'm not sure that applies here (the produced objects do work, they just behave in potentially unexpected ways). |
The options I see:
|
@liggitt
3 is also okay I think. Our docs say the default provisioning policy is Delete and again, users think of nil=="". In other words, instead of blindly passing "" to the pv defaulting code, we change it to Delete first. 4 I guess you mean "Retain" in the last word there. I know the "" vs nil pvc.spec.storageClassName documentation sets the precedent that it's possible (but not easy) to teach users ""!=nil. Also, I reeeally wish 1 were possible. Isn't there some way to automatically update all storageClasses with "" to "Retain" during an upgrade? |
On second thought the “unexpected data loss” risk might be overstated :) so options2 and 3 get some more points from me, but I still want 5 the most |
/test all Tests are more than 96 hours old. Re-running tests. |
@wongma7: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
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. |
What this PR does / why we need it: currently, storage classes are allowed to be created with
reclaimPolicy==""
which has no documented meaning. Our docs say that if storageclass.reclaimPolicy is unspecified/nil, the default reclaimPolicy is Delete but they say nothing about empty string/"". So we should make "" invalid.If the empty string from
storageClass.ReclaimPolicy
gets passed to a PV, the PV defaulting resets it toRetain
. IMO this is okay sincePV.Spec.PersistentVolumeReclaimPolicy
is not a pointer and we can consider this PV empty string behaviour "legacy" behaviour. But storageclasses should know better and should not be able to have reclaimPolicy=="" when we have documented that it must be either "nil" or one of the 2 valid policies.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Special notes for your reviewer: commit 1 fixes an issue where the error validation tests would succeed no matter what because none of them had volumeBindingMode set.
Release note: