Skip to content

Commit 90dc842

Browse files
author
Andi Li
committed
Address comments
1 parent 4ec0b74 commit 90dc842

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ checklist items _must_ be updated for the enhancement to be released.
164164
Items marked with (R) are required *prior to targeting to a milestone / release*.
165165

166166
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
167-
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
168-
- [ ] (R) Design details are appropriately documented
169-
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
167+
- [x] (R) KEP approvers have approved the KEP status as `implementable`
168+
- [x] (R) Design details are appropriately documented
169+
- [x] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
170170
- [ ] (R) Graduation criteria is in place
171171
- [ ] (R) Production readiness review completed
172172
- [ ] Production readiness review approved
@@ -187,7 +187,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
187187

188188
Tighten validation on `VolumeSnapshot` and `VolumeSnapshotContent` by updating the CRD validation schema and providing a webhook server to enforce immutability.
189189

190-
This KEP will list the new validation rules. It will also provide the release plan to ensure backwards compatibility. As well, it will outline the deployment plan of the webhook server. The webhook server is deployed separately from the snapshot controller
190+
This KEP will list the new validation rules. It will also provide the release plan to ensure backwards compatibility. As well, it will outline the deployment plan of the webhook server. The webhook server is deployed separately from the snapshot controller.
191191

192192
This tightening of the validation on volume snapshot objects is considered a change to the volume snapshot API. Choosing not to install the webhook server and participate in the 2-phase release process can cause future problems when upgrading from v1beta1 to V1 volumesnapshot API if there are currently persisted objects which fail the new stricter validation. Potential impacts include being unable to delete invalid snapshot objects. It should be possible to downgrade the CRD definition as a workaround.
193193

@@ -205,12 +205,12 @@ Admission webhooks are HTTP callbacks to intercept requests to the API server. T
205205

206206
Admission controllers have been in common use in kubernetes for a long time. Admission webhooks are the new, preferred way to control admission, especially for external (out-of-tree) components like the CSI external snapshotter.
207207

208-
A webhook server receives AdmissionReview(definition) requests from API server, and responses with a response of the same type to either admit/deny the request. Following simplified diagram shows the workflow.
208+
A webhook server receives [AdmissionReview](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#request) requests from API server, and responses with a response of the same type to either admit/deny the request. Following simplified diagram shows the workflow.
209209
(Note that the mutating webhooks will be invoked BEFORE validating).
210210

211211
![Webhook workflow diagram](./webhook-workflow.png)
212212

213-
The webhook server will expose an HTTP endpoint such that to allow the API server to send AdmissionReview requests. Webhook server providers can dynamically(details) configure what type of resources and what type of admission webhooks via creating CRs of type ValidatingWebhookConfiguration and/or MutatingWebhookConfiguration.
213+
The webhook server will expose an HTTP endpoint such that to allow the API server to send AdmissionReview requests. Webhook server providers can [dynamically](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly) configure what type of resources and what type of admission webhooks via creating CRs of type ValidatingWebhookConfiguration and/or MutatingWebhookConfiguration.
214214

215215
CRD validation is preferred over webhook validation due to their lower complexity, however CRD validation schema is unable to enforce immutability or provide ratcheting validation.
216216

@@ -280,7 +280,7 @@ Authentication on incoming requests to the webhook server is configurable howeve
280280

281281
### Timeout
282282

283-
Webhooks add latency to each API server call, thus setting up a reasonable timeout for each AdmissionReview request from the webhook server side is critical. The default timeout is 10 seconds if not specified. When an AdmissionReview request sent to the webhook server timed out, `failurePolicy`(default to `Fail` which is equivalent to disallow) will be triggered.
283+
Webhooks add latency to each API server call configured in the ValidationWebhookConfig/MutatingWebhookConfig, for this KEP it should only affect `CREATE` and `UPDATE` requests on snapshot resources. Thus setting up a reasonable timeout for each AdmissionReview request from the webhook server side is critical. The default timeout is 10 seconds if not specified. When an AdmissionReview request sent to the webhook server timed out, `failurePolicy`(default to `Fail` which is equivalent to disallow) will be triggered.
284284

285285
In the ValidatingWebhookConfiguration yaml [example](#kubernetes-api-server-configuration), a default timeout of two seconds is provided, cluster admins who wish to change the timeout may change the value of `timeoutSeconds`.
286286

@@ -292,7 +292,7 @@ Since only validating webhooks will be introduced in this version, idempotency/d
292292

293293
### Automatic Labelling of Invalid Objects
294294

295-
The controller will apply a label called `snapshot.storage.sigs.k8s.io/invalid-snapshot-resource` to `VolumeSnapshot` and `snapshot.storage.sigs.k8s.io/invalid-snapshot-content-resource` to `VolumeSnapshotContent` objects which fail strict validation. For valid objects the label will not be present, and for invalid objects it will be present. The value of the label does not matter, and is set to the empty string by default. The controller will use the same validation logic in the webhook.
295+
The controller will apply a label called `snapshot.storage.sigs.k8s.io/invalid-snapshot-resource` to `VolumeSnapshot` and `snapshot.storage.sigs.k8s.io/invalid-snapshot-content-resource` to `VolumeSnapshotContent` objects which fail strict validation. For valid objects the label will not be present, and for invalid objects it will be present. The value of the label does not matter, and is set to the empty string by default. The controller will use the same validation logic in the webhook.
296296

297297
For example here's the yaml for an invalid `VolumeSnapshot`:
298298

@@ -317,7 +317,7 @@ metadata:
317317
...
318318
```
319319

320-
Users and cluster admins MUST ensure there are NO objects with the labels applied before upgrading to phase 2.
320+
Users and cluster admins MUST ensure there are NO objects with the labels applied before upgrading to phase 2. The labels are added by the controller, and there may be a delay after deployment. It is recommended to wait 48 hours after installing the webhook and new controller, as the controller does a full resync of each snapshot resource every 24 hours.
321321

322322
### User Stories (Optional)
323323

@@ -445,7 +445,7 @@ A sample script will be provided which will handle the deployment of TLS certifi
445445

446446
### Kubernetes API Server Configuration
447447

448-
The API server must be configured to connect to the webhook server for certain API requests. This is done by creating a ValidatingWebhookConfiguration object. For a more thorough explanation of each field refer to the documentation. An example yaml file is provided below. The value of timeoutSeconds will affect the latency of snapshot creation, and must be considered carefully as it will affect the time the application may be frozen for.
448+
The API server must be configured to connect to the webhook server for certain API requests. This is done by creating a ValidatingWebhookConfiguration object. For a more thorough explanation of each field refer to the documentation. An example yaml file is provided below. The value of timeoutSeconds will affect the latency of snapshot creation, and must be considered carefully as it might affect the time the application is frozen for.
449449

450450
```yaml
451451
apiVersion: admissionregistration.k8s.io/v1
@@ -527,7 +527,7 @@ spec:
527527
### Test Plan
528528
There will be unit testing on the webserver in the same repository to ensure that the correct policy gets enforced.
529529
530-
Since the webhook is developed in the external-snapshotter repository, and does not test any csi driver, it would not be a good fit for e2e tests to go under the kubernetes core repository. Hence the plan for e2e tests is to add a new test job in external-snapshotter repo that brings up a kind cluster, installs crds and the webhook, and then runs validation tests.
530+
Since the webhook is developed in the external-snapshotter repository, and does not test any csi driver, it would not be a good fit for e2e tests to go under the kubernetes core repository. Hence the plan for e2e tests is to add a new test job in external-snapshotter repo that brings up a [kind](https://kind.sigs.k8s.io/) cluster, installs crds and the webhook, and then runs validation tests.
531531
532532
<!--
533533
**Note:** *Not required until targeted at a release.*

0 commit comments

Comments
 (0)