-
Notifications
You must be signed in to change notification settings - Fork 379
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
Adding validation rules into CRDs for validation #1073
Conversation
Welcome @cici37! |
Hi @cici37. Thanks for your PR. I'm waiting for a kubernetes-csi 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 @msau42 |
When I run We should fix the issue first and then do other steps. Modifying the generated manifest files is not a good practice. /hold /cc @xing-yang @jsafrane |
We made manual changes and documented what need to be changed in the README after running the scripts. It's possible that some of those changes are no longer needed. I'll take a look. /assign |
@cici37 Can these validation rules be generated automatically by adding some marker in the API definitions? https://github.com/kubernetes-csi/external-snapshotter/blob/master/client/apis/volumesnapshot/v1/types.go If not, we'll have to document these as manual steps to modify the manifest after running update-crd.sh: https://github.com/kubernetes-csi/external-snapshotter/tree/master/client/hack#update-crdsh |
/ok-to-test |
Thanks for the review! I have added the validation through kubebuilder marker. Do we still add the same rules under CRDs or it will be auto generated through kubebuilder? Thanks |
@xing-yang Thank you for updating the manifests! Is there any other changes needed in order to merge this PR? |
I collected a set of test cases here: https://github.com/leonardoce/volumesnapshot-cel/ |
@xing-yang @leonardoce Thanks for the review! I have addressed all the comments above. Please take a look when you have time. I could have a followup PR to remove the webhook after this one merged or please feel free to let me know if someone else is gonna do so :) |
/hold cancel |
Thanks @cici37 for addressing the comments! I'll update my PR (#1076) which updates the manifests based on this PR once this one is merged. After that I'll remove the webhook. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cici37, 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 |
This patch removes the logic to admit VolumeSnapshots, VolumeSnapshotContents, VolumeGroupSnapshots and VolumeGroupSnapshotContents in the validation webhook. This logic is already implemented via CEL expressions (see kubernetes-csi#1073) The logic to admit VolumeSnapshotClasses and VolumeGroupSnapshotClasses is still implemented in the webhook and avoids having multiple classes for the same CSI Driver.
This patch removes the logic to admit VolumeSnapshots, VolumeSnapshotContents, VolumeGroupSnapshots and VolumeGroupSnapshotContents in the validation webhook. This logic is already implemented via CEL expressions (see kubernetes-csi#1073) The logic to admit VolumeSnapshotClasses and VolumeGroupSnapshotClasses is still implemented in the webhook and avoids having multiple classes for the same CSI Driver.
This patch removes the logic to admit VolumeSnapshots, VolumeSnapshotContents, VolumeGroupSnapshots and VolumeGroupSnapshotContents in the validation webhook. That logic is already implemented via CEL expressions (see kubernetes-csi#1073) The logic to admit VolumeSnapshotClasses and VolumeGroupSnapshotClasses is still implemented in the webhook and avoids having multiple classes for the same CSI Driver.
This patch removes the logic to admit VolumeSnapshots, VolumeSnapshotContents, VolumeGroupSnapshots and VolumeGroupSnapshotContents in the validation webhook. That logic is already implemented via CEL expressions (see kubernetes-csi#1073) The logic to admit VolumeSnapshotClasses and VolumeGroupSnapshotClasses is still implemented in the webhook and avoids having multiple default classes for the same CSI Driver.
What type of PR is this?
/kind feature
What this PR does / why we need it:
This is to add validation rules to CRDs which did the same validation as written in https://github.com/kubernetes-csi/external-snapshotter/blob/master/pkg/validation-webhook/validation.go
Which issue(s) this PR fixes:
Fixes #1072
Special notes for your reviewer:
The feature is available since Kubernetes 1.25. Is there any version compatibility concern there? Could I remove the existing validating webhook in the same PR? Thank you!
Does this PR introduce a user-facing change?: