View Source Kubereq.Step.LabelSelector (kubereq v0.1.1)

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

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}

Summary

Functions