Skip to content

[v14] Add support for exact matching on an element in a delimited label#40184

Merged
rosstimothy merged 1 commit intobranch/v14from
bot/backport-40166-branch/v14
Apr 4, 2024
Merged

[v14] Add support for exact matching on an element in a delimited label#40184
rosstimothy merged 1 commit intobranch/v14from
bot/backport-40166-branch/v14

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

Backport #40166 to branch/v14

changelog: Add new resource filtering predicates to allow exact matches on a single item of a delimited list stored in a label value. For example, if given the following label containing a string separated list of values foo=bar,baz,bang, it is now possible to match on any resources with a label foo that contains the element bar via contains(split(labels[foo], ","), bar).

Updates the resource parser with two new functions: `contains` and
`split`. When used together they provide the ability to
search for resources that have labels with multiple values in a
delimited list. For example, if a resource has label `foo=bar,baz,bang`
then `split(labels[foo], ",")` would transform the
comma label value from a string into a list: ["bar", "baz", "bang"]
The list could then be fed to `contains` to determine if bar exists
in the list: `contains(split(labels[foo], ","), bar)`.
@rosstimothy rosstimothy marked this pull request as ready for review April 3, 2024 17:58
@github-actions github-actions Bot requested review from r0mant and zmb3 April 3, 2024 17:59
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from zmb3 April 4, 2024 07:21
@rosstimothy rosstimothy added this pull request to the merge queue Apr 4, 2024
Merged via the queue into branch/v14 with commit cd016f4 Apr 4, 2024
@rosstimothy rosstimothy deleted the bot/backport-40166-branch/v14 branch April 4, 2024 13:01
@fheinecke fheinecke mentioned this pull request Apr 12, 2024
This was referenced Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants