Skip to content

Commit 4d36613

Browse files
committed
Add fieldValidation field to create, patch, and update options
1 parent 8290d13 commit 4d36613

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

pkg/client/options.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,25 @@ type CreateOptions struct {
187187
// this request. It must be set with server-side apply.
188188
FieldManager string
189189

190+
// fieldValidation instructs the server on how to handle
191+
// objects in the request (POST/PUT/PATCH) containing unknown
192+
// or duplicate fields. Valid values are:
193+
// - Ignore: This will ignore any unknown fields that are silently
194+
// dropped from the object, and will ignore all but the last duplicate
195+
// field that the decoder encounters. This is the default behavior
196+
// prior to v1.23.
197+
// - Warn: This will send a warning via the standard warning response
198+
// header for each unknown field that is dropped from the object, and
199+
// for each duplicate field that is encountered. The request will
200+
// still succeed if there are no other errors, and will only persist
201+
// the last of any duplicate fields. This is the default in v1.23+
202+
// - Strict: This will fail the request with a BadRequest error if
203+
// any unknown fields would be dropped from the object, or if any
204+
// duplicate fields are present. The error returned from the server
205+
// will contain all unknown and duplicate fields encountered.
206+
// +optional
207+
FieldValidation string
208+
190209
// Raw represents raw CreateOptions, as passed to the API server.
191210
Raw *metav1.CreateOptions
192211
}
@@ -679,6 +698,25 @@ type UpdateOptions struct {
679698
// this request. It must be set with server-side apply.
680699
FieldManager string
681700

701+
// fieldValidation instructs the server on how to handle
702+
// objects in the request (POST/PUT/PATCH) containing unknown
703+
// or duplicate fields. Valid values are:
704+
// - Ignore: This will ignore any unknown fields that are silently
705+
// dropped from the object, and will ignore all but the last duplicate
706+
// field that the decoder encounters. This is the default behavior
707+
// prior to v1.23.
708+
// - Warn: This will send a warning via the standard warning response
709+
// header for each unknown field that is dropped from the object, and
710+
// for each duplicate field that is encountered. The request will
711+
// still succeed if there are no other errors, and will only persist
712+
// the last of any duplicate fields. This is the default in v1.23+
713+
// - Strict: This will fail the request with a BadRequest error if
714+
// any unknown fields would be dropped from the object, or if any
715+
// duplicate fields are present. The error returned from the server
716+
// will contain all unknown and duplicate fields encountered.
717+
// +optional
718+
FieldValidation string
719+
682720
// Raw represents raw UpdateOptions, as passed to the API server.
683721
Raw *metav1.UpdateOptions
684722
}
@@ -745,6 +783,25 @@ type PatchOptions struct {
745783
// this request. It must be set with server-side apply.
746784
FieldManager string
747785

786+
// fieldValidation instructs the server on how to handle
787+
// objects in the request (POST/PUT/PATCH) containing unknown
788+
// or duplicate fields. Valid values are:
789+
// - Ignore: This will ignore any unknown fields that are silently
790+
// dropped from the object, and will ignore all but the last duplicate
791+
// field that the decoder encounters. This is the default behavior
792+
// prior to v1.23.
793+
// - Warn: This will send a warning via the standard warning response
794+
// header for each unknown field that is dropped from the object, and
795+
// for each duplicate field that is encountered. The request will
796+
// still succeed if there are no other errors, and will only persist
797+
// the last of any duplicate fields. This is the default in v1.23+
798+
// - Strict: This will fail the request with a BadRequest error if
799+
// any unknown fields would be dropped from the object, or if any
800+
// duplicate fields are present. The error returned from the server
801+
// will contain all unknown and duplicate fields encountered.
802+
// +optional
803+
FieldValidation string
804+
748805
// Raw represents raw PatchOptions, as passed to the API server.
749806
Raw *metav1.PatchOptions
750807
}

0 commit comments

Comments
 (0)