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

RFC: Filter by metadata labels #21

Closed
jgriff opened this issue Sep 13, 2021 · 0 comments · Fixed by #23
Closed

RFC: Filter by metadata labels #21

jgriff opened this issue Sep 13, 2021 · 0 comments · Fixed by #23
Assignees
Labels
enhancement New feature or request rfc Request for comment

Comments

@jgriff
Copy link
Owner

jgriff commented Sep 13, 2021

Summary

Add support for filtering resources with a --selector (ie, metadata labels).

This would add a new selector option to the source filter configuration:

source:
  filter:
    selector: app=my-app

Any valid value for kubectl's --selector option can be specified here, including equality (=, ==, !=) and set-based requirements (in (...), notin (...)).

Examples

Single Label Match

source:
  filter:
    selector: environment=production

Multiple Label Match

source:
  filter:
    selector: environment=production,tier=frontend

Set-based Requirements

source:
  filter:
    selector: environment in (development,production),tier in (frontend)

Negative Matches

source:
  filter:
    selector: environment!=production
source:
  filter:
    selector: environment,environment notin (production)

Combining Styles

source:
  filter:
    selector: environment=production,tier in (frontend,backend) 
@jgriff jgriff added enhancement New feature or request rfc Request for comment labels Sep 13, 2021
@jgriff jgriff self-assigned this Sep 13, 2021
jgriff pushed a commit that referenced this issue Sep 17, 2021
You can now configure a `--selector` to use when querying the cluster
from `check`.

```yaml
source:
  filter:
    selector: app=my-app
```

Any valid label selector(s) can be specified, including combinations
using a comma separator.

```yaml
source:
  filter:
    selector: app=my-app,app.kubernetes.io/component in (frontend, backend)
```

See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
Closes #21
jgriff added a commit that referenced this issue Sep 17, 2021
You can now configure a `--selector` to use when querying the cluster
from `check`.

```yaml
source:
  filter:
    selector: app=my-app
```

Any valid label selector(s) can be specified, including combinations
using a comma separator.

```yaml
source:
  filter:
    selector: app=my-app,app.kubernetes.io/component in (frontend, backend)
```

See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
Closes #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rfc Request for comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant