-
Notifications
You must be signed in to change notification settings - Fork 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
Simplify custom resource metrics API by leveraging jq/CEL #1978
Comments
I like the idea of cleaning up the configuration. When doing so we should take care that we are still able to address all use-cases which got addressed currently. IMHO: if we introduce a new version for the configuration, we should do it in a way to have auto-conversion from the old configuration by using a custom config type as in https://book.kubebuilder.io/component-config-tutorial/config-type.html . Also related issue: #1948 . |
/triage accepted |
@CatherineF-dev could you perhaps start a design doc highlighting the different options we have to improve the UX of the existing API? |
Okay! |
Verified that can convert k8s objects into yamls https://github.com/kubernetes/kube-state-metrics/compare/main...CatherineF-dev:kube-state-metrics:cr-metrics-2?expand=1. |
Existing problems for KSM custom resource1. Custom resource API is complicated and not flexibleNow, it supports 7 operations: It’s not easy to use and brings some corner case issues.
Existing proposals: 2. Coupled monitoring pipeline and monitoring targetNeed to modify kube-state-metrics agents if you want to monitor one custom resource.
Existing proposals: ProposalSupports |
cc @dgrisonnet, What else do I need to add into #1978 (comment)? Thx! |
Feel free to open a PR adding your design doc under docs/design and we can review it from there |
Would this be capable of parsing annotation values as json? In some cases, we have controllers that save state on an object as json annotations. It would be nice to expose fields within those json objects. |
One point which came to my mind we should consider if this gets done: performance! |
I feel like we should use CEL since that's the direction that Kubernetes is moving. |
Reply @nathanperkins, I think CEL can parse annotation values as json. So it's feasible. Design doc is here: Simplify custom resource state metrics API using CEL(#2059) Also, it can support counting the number of CRs under one CRD. Or anything else which can be queried using CEL. |
I find we can reuse some codes from |
What would you like to be added:
Doc: #2059
A simplified API for CustomResourceStateMetrics, which only supports
values
andlabels
, instead of supportingeach
,path
,labelFromKey
,labelsFromPath
,valueFrom
,commonLabels
,labelsFromPath
and*
.In the above case, it will have these 2 metrics. The cardinality of each label (|label|) must equal to 1 or max(|values|, |label_i|). If |label| = 1, then this label is copied into N metric streams.
Why is this needed:
Describe the solution you'd like
Additional context
Han recommended cel
The text was updated successfully, but these errors were encountered: