hashicorp / waypoint-helm

Helm chart to install Waypoint and other associated components.
Mozilla Public License 2.0
29 stars 14 forks source link

feat: Add extra labels options to services #36

Closed ryanwholey closed 2 years ago

ryanwholey commented 2 years ago

Adds the option to pass extra labels to ui.service or the server.service.

Our use case is that we use external-dns to create DNS records for our Service and Ingress resources. Our external-dns deployment uses a label filter to determine whether it should create a DNS record for that resource or not. For our Waypoint installation, we are using the UI Service to create a load balancer as our point of ingress, so it would be ideal for us if we could also add a label to that Service which would allow our external-dns deployment to create a DNS record for that load balancer.

Tests:

Via CLI using --set

$ helm template . --set ui.service.labels="foo: bar"
# Source: waypoint/templates/ui-service.yaml
metadata:
  labels:
    ...
    foo: bar

Via values.yml as YAML

# extra-values.yml
server:
  service:
    labels:
      foo: bar
ui:
  service:
    labels:
      baz: woz
  ingress:
    enabled: true
    labels:
      traffic: external

$ helm template . --values extra-values.yml

# Source: waypoint/templates/server-service.yaml
metadata:
  labels:
    ...
    foo: bar
---
# Source: waypoint/templates/ui-service.yaml
metadata:  
  labels:
    ...
    baz: woz
---
# Source: waypoint/templates/server-ingress.yaml
...
metadata:
  labels:
    ...
    traffic: external

Via values.yml as string

# extra-values.yml
server:
  service:
    labels: |-
      foo: bar
ui:
  service:
    labels: |-
      baz: woz
  ingress:
    enabled: true
    labels: |-
      traffic: external

$ helm template . --values extra-values.yml

# Source: waypoint/templates/server-service.yaml
metadata:
  labels:
    ...
    foo: bar
---
# Source: waypoint/templates/ui-service.yaml
metadata:  
  labels:
    ...
    baz: woz
---
# Source: waypoint/templates/server-ingress.yaml
...
metadata:
  labels:
    ...
    traffic: external