# `Kubereq.Step.LabelSelector`
[🔗](https://github.com/mruoss/kubereq/blob/v0.4.3/lib/kubereq/step/label_selector.ex#L1)

Req step to format label selectors.

Label selectors are used to filter list and watch operations by resource
labels. The concept is explained on the Kubernetes
documentation [Labels and Selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels)

The functions for listing and watching resources accept an option
`:label_selectors` as a list of strings or tuples.

### Equality-based requirements

The following are equivalent label selectors for equality:

* `"environment = production"`
* `{"environment", "production"}`
* `{"environment", {:eq, "production"}}`

The following are equivalent label selectors for inequality:

* `"tier != frontend"`
* `{"tier", {:neq, "frontend"}}`
* `{"tier", {:ne, "frontend"}}`

### Set-based requirements

The following are equivalent label selectors for `In` requirements:

* `"environment in (production, qa)"`
* `{"environment", ["production", "qa"]}`
* `{"environment", {:in, ["production", "qa"]}}`

The following are equivalent label selectors for `NotIn` requirements:

* `"tier notin (frontend, backend)"`
* `{"tier", {:notin, ["frontend", "backend"]}}`
* `{"tier", {:not_in, ["frontend", "backend"]}}`

The following are equivalent label selectors for `Exists` requirements:

* `"partition"`
* `{"partition"}`
* `{"partition", :exists}`

The following are equivalent label selectors for `not DoesNotExist` requirements:

* `"!partition"`
* `{"!partition"}`
* `{"partition", :notexists}`
* `{"partition", :not_exists}`

# `call`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
