-
Notifications
You must be signed in to change notification settings - Fork 177
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
Validate metric name while listing available metrics and getting metric values #95
Comments
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 |
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 |
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 |
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 |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
Problem
Right now, it is possible for custom/external metrics adapter implemented using this library to expose and list metrics with names, which do not match Kubernetes resource naming convention, being as example:
Listing and getting metrics using uppercase characters work fine when you use
kubectl get --raw
, however, it does not work when one requests the metric e.g. using HPA object. Attempt to do so, results in the following error on HPA object:This is because either a client or API server downcases the requested resource name, so requesting metric named
E2E
results in client sending request for resourcee2e
.Solution
I think values received from methods in ExternalMetricsProvider should be sanitized before sending this data back to the client.
Notes
If needed, this can be implemented as an opt-in feature, to avoid breaking changes.
kubernetes/kubernetes#72996 also talks about it. Perhaps other characters like
/
should also be not allowed. However, I'm not able to find a full list of forbidden characters.EDIT:
It seems to me that ideally https://pkg.go.dev/k8s.io/[email protected]/pkg/api/validation/path#IsValidPathSegmentName should be used.
The text was updated successfully, but these errors were encountered: