labels Variable
Warning
This content is part of the legacy version of Waypoint that is no longer actively maintained. For additional information on the new vision of Waypoint, check out this blog post and the HCP Waypoint documentation.
Placement | app -> build app -> deploy app -> release |
The labels
variable is a map of the full set of labels that are
set for the current operation.
Example: Kubernetes Annotations
The example below shows how we can set annotations on a Kubernetes deployment to mirror the Waypoint labels we have set.
This examples goes a bit further and uses HCL map expressions to
prefix all our labels with "waypoint/" to note they come from Waypoint.
If you wanted to just map the labels directly, you can do
annotations = labels
directly.
Example: Conditional on Labels
The example below shows how we can use the selectormatch
function
to perform conditional logic with labels. The selector
-prefixed functions
all use the common label selector syntax that is used throughout various
features in Waypoint.
This could also be done with selectorlookup
which allows mapping
matching selector expressions to specific values: