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
@@ -232,7 +234,7 @@ Tighten the validation on Volume Snapshot objects. Please see the tables below f
232
234
233
235
Due to backwards compatibility concerns, the tightening will occur in two phases.
234
236
235
-
1. The first phase is webhook-only, and will use [ratcheting validation](#backwards-compatibility). It will be the user's responsibility to clean up invalid objects which already existed before the webhook was enabled. Invalid objects are those which fail the new, stricter validation. The controller will not be able to automatically fix invalid objects.
237
+
1. The first phase is webhook-only, and will use [ratcheting validation](#backwards-compatibility). It will be the user's responsibility to clean up invalid objects which already existed before the webhook was enabled. Invalid objects are those which fail the new, stricter validation. The controller will not be able to automatically fix invalid objects, however it will apply a [label](#automatic-labelling-of-invalid-objects) to invalid objects so that users can easily locate them.
236
238
2. The second phase can occur once all invalid objects are cleared from the cluster. It will be the cluster admin's responsibility to check and detect when it is safe to move to the second phase. The CRD schema validation will be tightened and the webhook will stick around to enforce immutability until immutable fields come to CRDs (Custom Resource Definition). This will be accompanied by a version change to make it clear the CRD is using different validation.
237
239
238
240
The phases come in separate releases to allow users / cluster admin the opportunity to clean their cluster of any invalid objects. More details are in the Risks and Mitigations section.
@@ -249,8 +251,6 @@ All of the validation desired can be achieved by updating the CRDs to take advan
249
251
250
252
There is a desire for some fields to be immutable, which is not yet supported by CRDs. See the immutable fields [KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190603-immutable-fields.md) for the latest updates. As of August 2020, the KEP is provisional and has no clear timeline for when immutable fields will come to CRDs.
251
253
252
-
Note that we may want to consider other fields to be marked as immutable.
253
-
254
254
#### VolumeSnapshot
255
255
256
256
| Operation | Field | Reason | HTTP RCode |
@@ -288,6 +288,35 @@ To avoid migration pain it is recommended to start with a `failurePolicy` value
288
288
289
289
Since only validating webhooks will be introduced in this version, idempotency/deadlock are not relevant.
290
290
291
+
### Automatic Labelling of Invalid Objects
292
+
293
+
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.
294
+
295
+
For example here's the yaml for an invalid `VolumeSnapshot`:
296
+
297
+
```yaml
298
+
apiVersion: snapshot.storage.k8s.io/v1beta1
299
+
kind: VolumeSnapshot
300
+
metadata:
301
+
name: snapshot-label-example
302
+
labels:
303
+
snapshot.storage.sigs.k8s.io/invalid-snapshot-resource: ""# Label applied for invalid VolumeSnapshot objects
304
+
...
305
+
```
306
+
307
+
Here's an example for the yaml for an invalid `VolumeSnapshotContent`:
snapshot.storage.sigs.k8s.io/invalid-snapshot-content-resource: ""# Label applied for invalid VolumeSnapshotContent objects
315
+
...
316
+
```
317
+
318
+
Users and cluster admins MUST ensure there are NO objects with the labels applied before upgrading to phase 2.
319
+
291
320
### User Stories (Optional)
292
321
293
322
<!--
@@ -354,7 +383,7 @@ Begin with validating webhook only enforcement. The webhook will perform the fol
354
383
- webhook is strict on create
355
384
- webhook is strict on updates where the existing object passes strict validation
356
385
- webhook is relaxed on updates where the existing object fails strict validation (allows finalizer removal, status update, deletion, etc)
357
-
- The user will need to delete or fix all invalid objects. The webhook and controllers will not take any automatic action to reconcile invalid objects.
386
+
- The user will need to delete or fix all invalid objects. The webhook and controllers will not take any automatic action to reconcile invalid objects. However, the controller will add a label.
358
387
359
388
For `UPDATE` operations, the webhook server will receive the existing object and the new, proposed object. We will use this feature to check when the existing objects passes or fails strict validation.
0 commit comments