Skip to content

Commit 5829080

Browse files
committed
Clarify default validate behavior
1 parent d18e5fe commit 5829080

File tree

1 file changed

+16
-12
lines changed
  • keps/sig-api-machinery/2885-server-side-unknown-field-validation

1 file changed

+16
-12
lines changed

keps/sig-api-machinery/2885-server-side-unknown-field-validation/README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ that server-side validation should either not be performed at all, provide
270270
warnings for the presence of unknown/duplicate fields, or error out in the
271271
presence of unknown/duplicate fields.
272272

273-
For beta, we propose modifying the kubectl `--validate` flag to enable users
274-
to choose between client-side validation or server-side
275-
validation (either strict or warning), when server-side validation is supported
276-
by the server (and default to strict server-side validation).
273+
When server-side validation is enabled on the server (as will be the default
274+
starting in beta), we propose modifying the kubectl `--validate` flag to
275+
default to server-side strict validation and allow the user to choose between
276+
strict, warn-only, or no validation.
277277

278278
### Notes/Constraints/Caveats (Optional)
279279

@@ -284,12 +284,16 @@ Upon successfully providing kubectl access to server-side validation via the
284284
`--validate` flag, an open question will remain as to the future of client
285285
side validation.
286286

287-
While we would like kubectl to use server-side validation by default once it
288-
is GA, the question remains whether client-side validation be optionally
289-
available to kubectl users or completely deprecated.
287+
Kubectl will use server-side validation by default starting in beta for servers
288+
that have it enabled. If kubectl does not recognize a server with server-side
289+
validation enabled, however, it will fall back to using client-side validation.
290+
This requires maintaining client-side validation indefinitely in kubectl, which
291+
has both pros and cons.
292+
293+
On the one hand, maintaining client-side validation gives users a way to
294+
validate their objects without needing access to a server, (albeit this
295+
mechanism is error-prone and not officially supported).
290296

291-
Maintaining client-side validation indefinitely provides the benefit of
292-
allowing users to validate their objects without needing access to a server.
293297
On the other hand, the downside of continuing to maintain client-side
294298
validation is that it uses openapiv2 which will be less actively supported
295299
as openapiv3 becomes standard and will cause client-side validation to
@@ -522,14 +526,14 @@ a string flag that accepts the following values:
522526

523527
* `true` or `strict`: If server-side validation is enabled on the server it sends
524528
a request with the fieldValidation param set to `Strict`, otherwise it falls
525-
back to client-side validation. This is the default
529+
back to client-side validation. The default remains `true`, as it currently is
530+
today.
526531
* `false` or `ignore`: This performs no server-side validation or client-side validation,
527532
sending a request to the server with fieldValidation param set to `Ignore` if
528533
server-side validation is enabled.
529534
* `warn`: This sends a request to the server with the fieldValidation param set
530535
to `Warn`. It performs server-side validation, but validation errors are
531-
exposed as warnings in the result header rather than failing the request. This
532-
will be the default once server-side validation goes GA.
536+
exposed as warnings in the result header rather than failing the request.
533537

534538

535539
### Test Plan

0 commit comments

Comments
 (0)