-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
webhook: Admission metrics are not reported by status code #2972
Comments
I believe the 200 response is if the webhook can create the response. There was an issue around this with failure policy and not sure if this helps with your issue #2662. |
Pretty much what troy said. I do agree that this is confusing and that it would be helpful to have metrics around the status code in the admission response. |
Indeed, after creating the issue I've realized HTTP response code must be 200 regardless of the admission response (which contains the status code the apiserver would return in its response body). Maybe we could still add a metric that parses the code out from |
/remove-kind bug |
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 |
This is several bugs in one bug since it appears multiple things are broken. Apologies if it gets too complicated.
Problem 1: It appears that controller-runtime webhooks always respond with HTTP status code
200 OK
even if the request is completely malformed.Example (sending a malformed request to a webhook endpoint):
Problem 2: controller-runtime webhooks do not use the
metav1.Status.Code
and always respond with HTTP status code200 OK
.Example code I used to register my custom handler at
/test
:And here's the query I am making:
Problem 3: controller-runtime doesn't expose any metrics about rejected requests and their
.status.code
s. This is likely becausecontroller_runtime_webhook_requests_total{code=...}
dimension to only200
and500
here:controller-runtime/pkg/webhook/internal/metrics/metrics.go
Lines 70 to 76 in 4cae9df
so even if I make a faulty request, only the code=200 metric goes up:
In an ideal state, I'd like to see
controller_runtime_webhook_requests_total
metric actually let me understand things like how many requests I'm denying (non-200 codes, such as 403, 400, 429, ...)./kind bug
The text was updated successfully, but these errors were encountered: