_helper.tpl 952 B

1234567891011121314151617181920212223242526272829303132
  1. {{- define "tailscale.args" -}}
  2. {{- $args := list -}}
  3. {{- with .Values.tailscaleConfig.hostname -}}
  4. {{- $args = mustAppend $args (printf "--hostname %v" .) -}}
  5. {{- end -}}
  6. {{- with .Values.tailscaleConfig.advertiseExitNode -}}
  7. {{- $args = mustAppend $args "--advertise-exit-node" -}}
  8. {{- end -}}
  9. {{- range $arg := .Values.tailscaleConfig.extraArgs -}}
  10. {{- $args = mustAppend $args $arg -}}
  11. {{- end -}}
  12. {{- if $args -}}
  13. {{- $args | join " " -}}
  14. {{- end -}}
  15. {{- end -}}
  16. {{- define "tailscale.validation" -}}
  17. {{- if not .Values.tailscaleConfig.authkey -}}
  18. {{- fail "Tailscale - Expected non-empty [Auth Key]" -}}
  19. {{- end -}}
  20. {{- with .Values.tailscaleConfig.hostname -}}
  21. {{- if not (mustRegexMatch "^[a-z0-9-]+$" .) -}}
  22. {{- fail "Tailscale - Expected [Hostname] to match the following - [All lowercase, numbers, dashes, No spaces, No underscores]" -}}
  23. {{- end -}}
  24. {{- end -}}
  25. {{- end -}}