@@ -225,8 +225,11 @@ know that this has succeeded?
225
225
misspelled), nor are any fields duplicated (for json and yaml data).
226
226
* We must maintain compatibility with all existing clients, thus server side
227
227
unknown field validation should be opt-in.
228
- * kubectl should provide the ability for a user to request server-side
229
- validation.
228
+ * kubectl should default to server-side validation against servers that support
229
+ it.
230
+ * kubectl should provide the ability for a user to request no validation,
231
+ warning only validation, or client-side validation (while it is still supported)
232
+ instead of strict server-side validation on a per-request basis.
230
233
231
234
### Non-Goals
232
235
@@ -266,12 +269,14 @@ presence of unknown/duplicate fields.
266
269
267
270
For beta, we propose modifying the kubectl ` --validate ` flag to enable users
268
271
to choose between client-side validation or server-side
269
- validation (either strict or warning)
272
+ validation (either strict or warning), when server-side validation is supported
273
+ by the server (and default to strict server-side validation).
270
274
271
275
### Notes/Constraints/Caveats (Optional)
272
276
273
277
#### Future Work
274
278
279
+ ##### Deprecating Client Side Validation
275
280
Upon successfully providing kubectl access to server-side validation via the
276
281
` --validate ` flag, an open question will remain as to the future of client
277
282
side validation.
@@ -352,7 +357,6 @@ parameter to indicate the level of field validation the server should perform,
352
357
such as ` ?fieldValidation=Strict ` .
353
358
354
359
Primary arguments for using query parameter include:
355
- * Being able version them with the API version.
356
360
* Parameters are discoverable in openapi.
357
361
* We have precedent for using query parameters for write requests already (via CreateOptions,
358
362
PatchOptions, UpdateOptions)
@@ -498,21 +502,21 @@ for strict server-side validation.
498
502
encounters any validation errors before sending a request to the server. If no
499
503
client-side validation errors are found, the request sent to the server has
500
504
fieldValidation param set to ` Ignore ` . This will be the default behavior in beta
501
- as it is identical to the current validation behavior pre-1.24
505
+ as it is identical to the current validation behavior pre-1.24.
502
506
* ` ignore ` : This performs no client-side validation or server-side validation,
503
507
sending a request to the server with fieldValidation param set to ` Ignore ` .
504
508
* ` warn ` : This sends a request to the server with the fieldValidation param set
505
509
to ` Warn ` . It performs server-side validation, but validation errors are
506
510
exposed as warnings in the result header rather than failing the request. This
507
511
will be the default once server-side validation goes GA.
508
- * ` strict ` : same behavior as ` --validate=server ` .
509
- * ` true ` : This is the same as ` --validate=client ` , but throws a warning along
510
- the lines of " ` --validate=true ` is being deprecated, use ` --validate=client `
511
- instead". This is also the default behavior if ` --validate ` flag is passed
512
- withouth a value set.
513
- * ` false ` : This is the same as ` --validate=ignore ` , but throws a warning along
514
- the lines of " ` --validate=false ` is being deprecated use ` --validate=ignore `
515
- instead".
512
+ * ` strict ` : same behavior as ` --validate=server ` . This will be the default
513
+ behavior for servers with the server-side field validation feature enabled.
514
+ * ` true ` : This is the same as ` --validate=strict ` for servers where server side field
515
+ validation is enabled. For pre-1.24 servers and servers with the server-side
516
+ field validation feature disabled, this will perform client-side validation
517
+ identical to ` --validate=client ` . Passing the ` --validate ` flag
518
+ without a value set behaves identical to ` --validate=true ` .
519
+ * ` false ` : This is the same as ` --validate=ignore `
516
520
517
521
518
522
### Test Plan
@@ -580,18 +584,10 @@ Below are some examples to consider, in addition to the aforementioned [maturity
580
584
581
585
#### Beta
582
586
583
- - kubectl validate flag offers ability to perform server-side validation
584
- - All follow-ups from alpha are complete (see below)
585
-
586
- ##### Alpha Follow Ups
587
-
588
- These are some tasks that were initially planned for alpha, but did not make it
589
- and should be addressed before beta is considered complete.
587
+ - [ ] kubectl validate flag offers ability to perform server-side validation
590
588
- [ ] endpoints handler unit testing of field validation
591
589
- [ ] customresource handler unit testing of field validation
592
590
- [ ] field validation integration tests check for exact match of strict errors
593
- - [ ] [ sigs.k8s.io/yaml should
594
- report] ( https://github.com/kubernetes/kubernetes/pull/105916#discussion_r748530682 ) strict errors consistent with kjson
595
591
- [ ] [ make
596
592
use] ( https://github.com/kubernetes/kubernetes/pull/105916#discussion_r746125180 ) of the decoded object rather than decoding multiple times
597
593
- [ ]
747
743
748
744
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
749
745
750
- For beta we will be warning kubectl users that ` --validate={true,false} ` is
751
- being deprecated in favor of ` --validate={client,server,strict,warn,ignore} ` .
746
+ No deprecations or removals however the kubectl flag ` --validate=true ` is being changed
747
+ to perform server-side validation instead of client-side validation (for servers
748
+ that support it).
752
749
753
750
### Monitoring Requirements
754
751
@@ -871,7 +868,12 @@ Think about adding additional work or introducing new steps in between
871
868
-->
872
869
Mutating API calls that opt-in to validation will be slower.
873
870
Benchmarks of alpha changes indicate that performing validation results in
874
- ~ 2-5% slower request latency and ~ 4-8% more memory usage.
871
+ ~ 2-5% slower request latency and ~ 4-8% more memory usage for json and yaml
872
+ requests.
873
+
874
+ Given that the majority of high-frequency requests made by system
875
+ components use protobuf, we expect a negligible increase in overall resource
876
+ usage.
875
877
876
878
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
877
879
0 commit comments