You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The prevailing convention in Kubernetes resource validation is to report all validation errors, not only the first discovered error. The built-in API types follow this convention (example). The OpenAPI and CEL rule validation follows this convention, too. Most webhooks I have seen also follow it.
We provide a utility function for webhook authors that executes multiple validators:
It returns as soon as one validator fails. That means that subsequent validators are not called, and any errors they might discover are not reported.
I think we should provide an alternative implementation that calls all validators, even if some fail, and aggregates their errors.
Also, because the existing utility function does not follow the convention, I think we should consider deprecating it.
The text was updated successfully, but these errors were encountered:
dlipovetsky
changed the title
MultiValidatingHandler should always call all handlers
MultiValidatingHandler returns as soon as one handler fails, making it impossible to follow convention of reporting all validation errors
Apr 29, 2025
Uh oh!
There was an error while loading. Please reload this page.
The prevailing convention in Kubernetes resource validation is to report all validation errors, not only the first discovered error. The built-in API types follow this convention (example). The OpenAPI and CEL rule validation follows this convention, too. Most webhooks I have seen also follow it.
We provide a utility function for webhook authors that executes multiple validators:
controller-runtime/pkg/webhook/admission/multi.go
Lines 90 to 95 in 6ad5c1d
It returns as soon as one validator fails. That means that subsequent validators are not called, and any errors they might discover are not reported.
I think we should provide an alternative implementation that calls all validators, even if some fail, and aggregates their errors.
Also, because the existing utility function does not follow the convention, I think we should consider deprecating it.
The text was updated successfully, but these errors were encountered: