From 1dfb0f8dfb673eb8c203ba85141d75ef16cfc2a1 Mon Sep 17 00:00:00 2001 From: Kevin Delgado Date: Mon, 22 Nov 2021 20:48:00 +0000 Subject: [PATCH] Add docs for fieldValidation parameter --- .../common-parameters/common-parameters.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/content/en/docs/reference/kubernetes-api/common-parameters/common-parameters.md b/content/en/docs/reference/kubernetes-api/common-parameters/common-parameters.md index 5d6e58485d3bf..9d1f20b520c52 100644 --- a/content/en/docs/reference/kubernetes-api/common-parameters/common-parameters.md +++ b/content/en/docs/reference/kubernetes-api/common-parameters/common-parameters.md @@ -60,7 +60,26 @@ When present, indicates that modifications should not be persisted. An invalid o ## fieldValidation {#fieldValidation} -TODO +When both the fieldValidation parameter is present and the `ServerSideFieldValidation` feature gate is enabeld, it instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: +- Ignore: This will ignore any unknown fields, silently dropping them from the + object, and ignore all but the last duplicate field that the decoder + encounters. This is the default behavior prior to v1.23 and is the default + behavior whent the `ServerSideFieldValidation` feature gate is disabled. +- Warn: This will send a wanring via the [standarding warning response + header](https://datatracker.ietf.org/doc/html/rfc7234#section-5.5) for each + unknown or duplicate field it encounters. The request will still succeed if + there are no other errors and the resulting object will drop any unknown + fields an only persist the last of any duplicate fields. This is the default + when the `ServerSideFieldValidation` feature gate is enabled. +- Strict: This will fail the request with a BadRequest error if any unknown or + duplicate fields are present. The error returned from the server will contain + all unknown and duplicate fields encountered. + + +One exception is that CRDs with the `x-kubernetes-preserve-unknown-fields` +property will continue to preserve the unknown fields and will not indicate via +warning/error if an unknown field is detected for any node in the custom +resource that has `x-kubernetes-preserve-unknown-fields` set.