-
Notifications
You must be signed in to change notification settings - Fork 358
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
Add webhook to make SourceVolumeMode immutable #680
Conversation
This webhook should have a feature flag as well? |
Done! |
@@ -341,8 +341,6 @@ type VolumeSnapshotContentSpec struct { | |||
// VolumeSnapshotContentSource represents the CSI source of a snapshot. | |||
// Exactly one of its members must be set. | |||
// Members in VolumeSnapshotContentSource are immutable. | |||
// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotContentSource members |
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.
Not sure why this isn't checked in already. My CI was failing without this change.
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.
That's very strange. It didn't fail CI when the original PR was merged.
@@ -67,6 +68,8 @@ func init() { | |||
CmdWebhook.MarkFlagRequired("tls-private-key-file") | |||
// Add optional flag for kubeconfig | |||
CmdWebhook.Flags().StringVar(&kubeconfigFile, "kubeconfig", "", "kubeconfig file to use for volumesnapshotclasses") | |||
CmdWebhook.Flags().BoolVar(&preventVolumeModeConversion, "prevent-volume-mode-conversion", | |||
false, "Prevents an unauthorised user from modifying the volume mode when creating a PVC from an existing VolumeSnapshot.") |
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.
Please submit a followup PR to update README.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RaunakShah, xing-yang 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 |
Can you backport this to release-6.0? |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds changes to snapshot-validation-webhook to make the
SourceVolumeMode
field immutable.KEP - https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3141-prevent-volume-mode-conversion
Testing
Deploy
snapshot-controller
with Changes to snapshot controller to add sourceVolumeMode #679Create
VolumeSnapshot
object and attempt to alterSpec.SourceVolumeMode
fromFilesystem
toBlock
. The attempt fails with the below error:Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: