-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Feature Request]: Support "Warning" for Validation Webhook #1896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
what do you think? If you are not satisfied with this design, I am very happy to make it better. :) |
@STRRL Thanks. Does the existing controller-runtime/pkg/webhook/admission/response.go Lines 116 to 121 in 26c95ad
We can use it with any response like // ...
return admission.Allowed("").WithWarnings("warning message ...") |
Ohh, I missed that method. That would help a lot. We do not require the first step in my original design. ❤️ But the user still needs to implement |
Emm... I don't really understand. |
I think it's better also support waning on high-level API |
Oh, you mean expose the controller-runtime/pkg/webhook/admission/validator.go Lines 30 to 35 in 26c95ad
controller-runtime/pkg/webhook/admission/validator_custom.go Lines 31 to 35 in 26c95ad
That's ok to me. But I'm not sure if the API change is necessary. WDYT @alvaroaleman @vincepri |
controller-runtime/pkg/webhook/admission/validator.go Lines 71 to 78 in b826f39
One different thing is a user might want only to respond "warnings" without "error". I realized that my original design might not work well with this situation, because it could not resolve the error is nil. Maybe make changes on type ValidatorWarning interface {
runtime.Object
ValidateCreate() (err error, warnings []string)
ValidateUpdate(old runtime.Object) (err error, warnings []string)
ValidateDelete() (err error, warnings []string)
} |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Hi @invidian , I create a PR for resolve this issue, PTAL ❤️ |
also cc @FillZpp |
We could resolve that right? If the error is an If the returned error is not an |
@joelanford's suggestion sounds good to me I think we have one fundamental choice to make and then everything follows from there:
@alvaroaleman @vincepri Sorry for the ping, I know you're pretty busy. What is your opinion on that? P.S. Does 2. come down to the same as #1788? |
Hm, after skimming the conversation I am actually in favor of breaking the interface over making it hard to use in the context of warnings by having to return a specific error type. It will be a visible break that is easy to fix. The only comment I have on the suggestion in #1896 (comment) regarding how that would look like is that errors per golang convention should always be the last return parameter. |
Sounds good to me! |
+1 |
No. I do not think we could resolve that, because |
I would update the PR soon! |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
refer: #1788
After Kubernetes 1.19, the webhook could respond with "warning"s, refer: https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#response
Warnings for validation webhook would bring much help for users with interacting with API.
Currently, users of controller-runtime could implement their "customized"
admission.Handler
to respond with "warnings". But it's might be not easy to use. Also as mentioned in #1788, using util to wrap warning messages might be helpful. IMHO, controller-runtime should support warning "natively" withValidator
andCustomValidator
.I am interested in this feature/enhancement, so maybe there are possible designs and steps to build this feature:
Allowed()
,Denied()
,ValidationResponse()
, make them supportwarning []string
ErrorWithWarnings
like:ValidateXXX()
Validator
/CustomValidator
, fillWarnings
inv1.AdmissionResponse
Some changes might break the existing API, I think it's OK to controller-runtime. If not, I could still try to only introduce new API without breaking the exist one.
The text was updated successfully, but these errors were encountered: