Skip to content

Commit c176438

Browse files
committed
Clearer messaging around CS validation deprecation
1 parent 4e9a9bd commit c176438

File tree

1 file changed

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

1 file changed

+27
-21
lines changed

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

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -276,40 +276,44 @@ starting in beta), we propose modifying the kubectl `--validate` flag to
276276
default to server-side strict validation and allow the user to choose between
277277
strict, warn-only, or no validation.
278278

279+
We propose documenting that client-side validation is deprecated and server-side
280+
validation will be used instead by default if available. We will fallback to
281+
client-side validation in the mean time if kubectl does not connect to a server
282+
with server-side validation enabled (either because the server it is connected
283+
to is older or has the feature-gate disabled, or because kubectl is not
284+
connected to any server at all).
285+
286+
When we fallback to client-side validation we will send a warning to let users
287+
know that their request is being validated by the deprecated client-side
288+
validation.
289+
279290
### Notes/Constraints/Caveats (Optional)
280291

281292
#### Future Work
282293

283-
##### Deprecating Client Side Validation
294+
##### Out-of-Tree Alternatives to Client Side Validation
284295
Upon successfully providing kubectl access to server-side validation via the
285296
`--validate` flag, an open question will remain as to the future of client
286297
side validation.
287298

288299
Kubectl will use server-side validation by default starting in beta for servers
289300
that have it enabled. If kubectl does not recognize a server with server-side
290-
validation enabled, however, it will fall back to using client-side validation.
291-
This requires maintaining client-side validation indefinitely in kubectl, which
292-
has both pros and cons.
293-
294-
On the one hand, maintaining client-side validation gives users a way to
295-
validate their objects without needing access to a server, (albeit this
296-
mechanism is error-prone and not officially supported).
301+
validation enabled, however, it will fall back to using client-side validation
302+
with a deprecation warning.
297303

298-
On the other hand, the downside of continuing to maintain client-side
299-
validation is that it uses openapiv2 which will be less actively supported
300-
as openapiv3 becomes standard and will cause client-side validation to
301-
continue to diverge from server-side validation.
304+
Even though we feel deprecating client-side validation is justified due to the
305+
inevitability of it always being less correct than server-side validation, we
306+
still acknowledge that their are benefits to giving users a way to validate
307+
their objects without needing access to a server (which is a current use-case of
308+
client-side validation, albeit one that is error-prone and not officially
309+
supported).
302310

303-
We propose offering a separate KEP to tackle deprecating client-side validation
304-
once server-side validation is GA. Our initial thoughts on this are that in
305-
order to deprecate client-side validation we will need to build a separate
306-
out-of-tree client-side validation mechanism so that users can continue to
307-
validate their configs.
311+
Long-term, we want to favor using out-of-tree solutions for client-side
312+
validation, though this idea is still in its infancy.
308313

309314
The [kubeval](https://www.kubeval.com/) project is an example of an out-of-tree solution that does this, and
310315
we will look into expanding its support of open API to v3, and investigate
311-
whether it makes sense as a permanent solution to client-side validation that
312-
will allow for deprecation of current client-side validation.
316+
whether it makes sense as a permanent solution to client-side validation.
313317

314318
##### Aligning json and yaml errors
315319

@@ -527,8 +531,10 @@ a string flag that accepts the following values:
527531

528532
* `true` or `strict`: If server-side validation is enabled on the server it sends
529533
a request with the fieldValidation param set to `Strict`, otherwise it falls
530-
back to client-side validation. The default remains `true`, as it currently is
531-
today.
534+
back to client-side validation. It will also fall back to client-side
535+
validation if the request has `--dry-run=client`, because the request is not
536+
actually being sent to a server-side validation enabled server.
537+
The default remains `true`, as it currently is today.
532538
* `false` or `ignore`: This performs no server-side validation or client-side validation,
533539
sending a request to the server with fieldValidation param set to `Ignore` if
534540
server-side validation is enabled.

0 commit comments

Comments
 (0)