You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,9 +164,9 @@ checklist items _must_ be updated for the enhancement to be released.
164
164
Items marked with (R) are required *prior to targeting to a milestone / release*.
165
165
166
166
-[ ] (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
170
170
-[ ] (R) Graduation criteria is in place
171
171
-[ ] (R) Production readiness review completed
172
172
-[ ] Production readiness review approved
@@ -187,7 +187,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
187
187
188
188
Tighten validation on `VolumeSnapshot` and `VolumeSnapshotContent` by updating the CRD validation schema and providing a webhook server to enforce immutability.
189
189
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.
191
191
192
192
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.
193
193
@@ -205,12 +205,12 @@ Admission webhooks are HTTP callbacks to intercept requests to the API server. T
205
205
206
206
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.
207
207
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.
209
209
(Note that the mutating webhooks will be invoked BEFORE validating).
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.
214
214
215
215
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.
216
216
@@ -280,7 +280,7 @@ Authentication on incoming requests to the webhook server is configurable howeve
280
280
281
281
### Timeout
282
282
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.
284
284
285
285
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`.
286
286
@@ -292,7 +292,7 @@ Since only validating webhooks will be introduced in this version, idempotency/d
292
292
293
293
### Automatic Labelling of Invalid Objects
294
294
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.
296
296
297
297
For example here's the yaml for an invalid `VolumeSnapshot`:
298
298
@@ -317,7 +317,7 @@ metadata:
317
317
...
318
318
```
319
319
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.
321
321
322
322
### User Stories (Optional)
323
323
@@ -445,7 +445,7 @@ A sample script will be provided which will handle the deployment of TLS certifi
445
445
446
446
### Kubernetes API Server Configuration
447
447
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.
449
449
450
450
```yaml
451
451
apiVersion: admissionregistration.k8s.io/v1
@@ -527,7 +527,7 @@ spec:
527
527
### Test Plan
528
528
There will be unit testing on the webserver in the same repository to ensure that the correct policy gets enforced.
529
529
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.
531
531
532
532
<!--
533
533
**Note:** *Not required until targeted at a release.*
0 commit comments