-
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
feat: allow field KV general matching #2067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you an example use case for this?
So right now we don't support generating metrics from a map for a # instance A
# ...
labels:
foo: "bar"
# ...
---
# instance B
# ...
labels:
foo: "baz"
# ...
---
# config
# ...
labelsFromPath:
foo: [metadata, labels, "foo:bar"]
# ... |
1098f2b
to
c805566
Compare
Closing in favor of the newer model. |
Reopening in favor of #2068 (comment). |
docs/customresourcestate-metrics.md
Outdated
@@ -480,4 +480,7 @@ Examples: | |||
|
|||
# if the value to be matched is a number or boolean, the value is compared as a number or boolean | |||
[status, conditions, "[value=66]", name] # status.conditions[1].name = "b" | |||
|
|||
# For generally matching against a field in an object schema, use the following syntax: | |||
[metadata, annotations, "bar:baz"] # metadata.annotations["bar:baz"] = "baz" (if present, ignored otherwise) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be in line with how we specify values, what would you think about:
[metadata, annotations, "[key=bar]", "[value=baz]"]
I feel like it would be easier for users if we stick to the existing UX we have for values and just extend it to keys.
/triage accepted |
3ac7b7c
to
e7d0e44
Compare
docs/customresourcestate-metrics.md
Outdated
@@ -480,4 +480,7 @@ Examples: | |||
|
|||
# if the value to be matched is a number or boolean, the value is compared as a number or boolean | |||
[status, conditions, "[value=66]", name] # status.conditions[1].name = "b" | |||
|
|||
# For generally matching against a field in an object schema, use the following syntax: | |||
[metadata, annotations, "bar=baz"] # metadata.annotations["bar=baz"] = "baz" (if present, ignored otherwise) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do a "name=a" here similar to a couple of lines above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed, PTAL.
Currently all matching support is limited to map-list representations; this adds support for a more general "key:value" based matching expression for any `interface{}` field (non-map-list-like).
e7d0e44
to
e52fbce
Compare
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/unhold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgrisonnet, mrueg, rexagod The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it: Currently all matching support is limited to map-list representations; this adds support for a more general "key:value" based matching expression for any
interface{}
field (non-map-list-like).How does this change affect the cardinality of KSM: No change.