feat: enable use of CEL expressions for CR valueFrom#2868
feat: enable use of CEL expressions for CR valueFrom#2868alexandernorth wants to merge 10 commits intokubernetes:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alexandernorth The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
Adds CEL (Common Expression Language) support to Custom Resource State metrics for transforming and extracting values from custom resources.
CEL expressions enable more complex calculations, conditional logic, array/object iteration, and dynamic label generation directly in metric configurations, with a low cost overhead. This is more flexible than the existing path-based approach for complex data structures (multi-level, iteration, etc).
Examples:
Static number:
Iterate over arrays adding dynamic labels:
Path-based valueFrom continues to work unchanged for backwards compatibility.
The documentation is also updated to include examples and details on the implementation customresourcestate-metrics.md
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
None.
Which issue(s) this PR fixes: (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged)I did not find a specific comment, but it does solve a TODO regarding multi-length valueFrom paths: #1958 (comment)