feat(labeler): support comma-separated JSONPath queries in DefaultQuery#429
Closed
browdues wants to merge 1 commit into
Closed
feat(labeler): support comma-separated JSONPath queries in DefaultQuery#429browdues wants to merge 1 commit into
browdues wants to merge 1 commit into
Conversation
JeroenSoeters
requested changes
Apr 23, 2026
Collaborator
JeroenSoeters
left a comment
There was a problem hiding this comment.
I'd push back on this:
The field is documented as a JSONPath query expression, after this PR, it no longer is one. Comma-separated queries are a custom invention layered on top, this means:
- the semantics become somewhat surprising, everyone reading
$.metadata.namespace,$.metadata.namewould reasonably try to validate it as a JSONPath expression and be confused when it fails. - JSONPath queries themselves can contain commas,
strings.Split(query, ",")would break those
Also JSONPath already has a union operator. The standard syntax $['metadata']['namespace','name'] selects multiple fields. I believe we might be doing this already in AWS. The only restriction is that this operator can only select keys from the same top-level parent, it cannot select keys from different part of the tree. If we need this I suggest we switch to a slice on the interface DefaultQueries []string. It looks though that we might get away with the union operator here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows comma-separated JSONPath expressions in LabelConfig.DefaultQuery.
Each expression is evaluated independently and results are joined with
-.This enables K8s-style labels like
namespace-namefrom a single query string:$.metadata.namespace,$.metadata.name. Cluster-scoped resources (no namespace) naturally produce just the name since the missing field returns no result and is skippedPreviously, DefaultQuery only accepted a single JSONPath. Plugins needing multi-field labels had no option — K8s resources collided when a Service and its auto-created Endpoints shared the same name.