pkg/webhook/testing
Matt Moore 16b36b7fca
Add support for admission webhook warnings. (#2498)
* Add support for admission webhook warnings.

This extends `apis.FieldError` to support designating certain FieldErrors as "warnings" (or explicitly as "errors", however, this is the default for back-compat).

You can turn an `apis.FieldError` into a warning using: `fe.At(apis.WarningLevel)` or force it into an error using: `fe.At(apis.ErrorLevel)`.

You can get the errors at a particular diagnostic level using: `fe.Filter(apis.WarningLevel)`.

This change also hooks this into the admission webhook infrastructure to support surfacing the "warning" level `apis.FieldError`s via the `Warnings` section of the `AdmissionResponse`.

Fixes: #2497

* Add a comment about the use of defer.
2022-05-02 21:56:57 +00:00
..
factory.go bump k8s to v1.20.7 (#2145) 2021-06-10 06:56:43 -07:00
listers.go Align linters with serving (enables stylecheck and asciicheck) (#1738) 2020-09-23 07:37:40 -07:00
testing.go Add support for admission webhook warnings. (#2498) 2022-05-02 21:56:57 +00:00