kubernetes-csi / external-snapshotter

Sidecar container that watches Kubernetes Snapshot CRD objects and triggers CreateSnapshot/DeleteSnapshot against a CSI endpoint.
Apache License 2.0
463 stars 361 forks source link

Remove duplicate validation logic from webhook #1091

Closed leonardoce closed 2 months ago

leonardoce commented 2 months ago

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 #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?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change /kind bug /kind cleanup /kind design /kind documentation /kind failing-test /kind feature /kind flake

What this PR does / why we need it:

Removes the logic that is already implemented with CEL expressions from the validation webhook.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

The validating logic for VolumeSnapshots, VolumeSnapshotContents, VolumeGroupSnapshots, and
VolumeGroupSnapshotContents has been replaced by CEL validation rules. The validating webhook
is now only being used for VolumeSnapshotClasses and VolumeGroupSnapshotClasses to ensure
that there's at most one class per CSI Driver.
The validation webhook is deprecated and will be removed in the next release. 
xing-yang commented 2 months ago

@leonardoce Can you please add a release note? The code change looks good to me.

leonardoce commented 2 months ago

Done @xing-yang. Thank you!

xing-yang commented 2 months ago

/lgtm /approve

k8s-ci-robot commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leonardoce, 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: - ~~[OWNERS](https://github.com/kubernetes-csi/external-snapshotter/blob/master/OWNERS)~~ [xing-yang] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment