Skip to content
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

Ability to parse expressions that can filter and/or map a list #30

Merged
merged 1 commit into from
May 4, 2024

Conversation

jordipiqueselles
Copy link
Collaborator

These expressions have the following format:

<reference> (("|" "->") <expr>)

is a reference to a list in the yaml that we're processing. What we have on the right hand side is a filter ("|") or a map ("->"). The is the function used to filter or map the list in the left hand side. We can have multiple filters and/or maps on the right. For example, we can see if all the side containers request less than 1 cpu using the following expression:

all: .spec.containers | .name != "main" -> .requests.cpu < 1

These expressions have the following format:

```
<reference> (("|" "->") <expr>)
```

<reference> is a reference to a list in the yaml that we're processing.
What we have on the right hand side is a filter ("|") or a map ("->").
The <expr> is the function used to filter or map the list in the left
hand side. We can have multiple filters and/or maps on the right. For
example, we can see if all the side containers request less than 1 cpu
using the following expression:

```
all: .spec.containers | .name != "main" -> .requests.cpu < 1
```
@jordipiqueselles jordipiqueselles added the enhancement New feature or request label May 4, 2024
@jordipiqueselles jordipiqueselles merged commit 5d21f87 into main May 4, 2024
2 checks passed
@jordipiqueselles jordipiqueselles deleted the jordi/list-filter-map branch May 4, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant