Files
chart/library/ix-dev/community/tailscale/templates/_helper.tpl
2023-07-27 21:03:34 +03:00

33 lines
952 B
Smarty

{{- define "tailscale.args" -}}
{{- $args := list -}}
{{- with .Values.tailscaleConfig.hostname -}}
{{- $args = mustAppend $args (printf "--hostname %v" .) -}}
{{- end -}}
{{- with .Values.tailscaleConfig.advertiseExitNode -}}
{{- $args = mustAppend $args "--advertise-exit-node" -}}
{{- end -}}
{{- range $arg := .Values.tailscaleConfig.extraArgs -}}
{{- $args = mustAppend $args $arg -}}
{{- end -}}
{{- if $args -}}
{{- $args | join " " -}}
{{- end -}}
{{- end -}}
{{- define "tailscale.validation" -}}
{{- if not .Values.tailscaleConfig.authkey -}}
{{- fail "Tailscale - Expected non-empty [Auth Key]" -}}
{{- end -}}
{{- with .Values.tailscaleConfig.hostname -}}
{{- if not (mustRegexMatch "^[a-z0-9-]+$" .) -}}
{{- fail "Tailscale - Expected [Hostname] to match the following - [All lowercase, numbers, dashes, No spaces, No underscores]" -}}
{{- end -}}
{{- end -}}
{{- end -}}