diff --git a/charts/headscale/Chart.yaml b/charts/headscale/Chart.yaml index 7178e7375..0b06bb64e 100644 --- a/charts/headscale/Chart.yaml +++ b/charts/headscale/Chart.yaml @@ -27,4 +27,4 @@ sources: annotations: artifacthub.io/changes: |- - kind: changed - description: Replace PNG icon with SVG + description: Don't overwrite config if already exists. Envs are still suggested, but not required anymore. diff --git a/charts/headscale/README.md b/charts/headscale/README.md index 8439245bc..b9eb29498 100644 --- a/charts/headscale/README.md +++ b/charts/headscale/README.md @@ -79,7 +79,7 @@ Headscale runs in a distroless Docker container, which does not have any of the expected command line utilities. This keeps the container small and minimizes the possibility of CVEs, but it makes working with a config file in Kubernetes more difficult. -To keep config simple, this Helm chart opts to use environment variables. +To keep config simple, this Helm chart suggests using environment variables. All of the Headscale config variables are supported as envs, but official documentation is lacking. To configure Headscale: diff --git a/charts/headscale/README_CONFIG.md.gotmpl b/charts/headscale/README_CONFIG.md.gotmpl index a9da01dd6..fe9495667 100644 --- a/charts/headscale/README_CONFIG.md.gotmpl +++ b/charts/headscale/README_CONFIG.md.gotmpl @@ -9,7 +9,7 @@ Headscale runs in a distroless Docker container, which does not have any of the expected command line utilities. This keeps the container small and minimizes the possibility of CVEs, but it makes working with a config file in Kubernetes more difficult. -To keep config simple, this Helm chart opts to use environment variables. +To keep config simple, this Helm chart suggests using environment variables. All of the Headscale config variables are supported as envs, but official documentation is lacking. To configure Headscale: diff --git a/charts/headscale/templates/common.yaml b/charts/headscale/templates/common.yaml index 4965a6884..c3fb4bf0f 100644 --- a/charts/headscale/templates/common.yaml +++ b/charts/headscale/templates/common.yaml @@ -14,17 +14,22 @@ initContainers: - sh - -c - | - cat <<'EOF' >/etc/headscale/config.yaml - # Please use environment variables to configure Headscale. - # For config reference, see https://github.com/juanfont/headscale/blob/main/config-example.yaml - # To configure any of these as an env: - # 1. Flatten object keys using "_" - # 2. Prefix with "HEADSCALE_" - # - # For example: - # - "listen_addr" becomes "HEADSCALE_LISTEN_ADDR" - # - "log.level" becomes "HEADSCALE_LOG_LEVEL" + if [[ -f '/etc/headscale/config.yaml' ]]; then + echo 'Config already exists' >&2 + else + echo 'Writing empty config' >&2 + cat <<- 'EOF' >/etc/headscale/config.yaml + # It's suggested to use environment variables to configure Headscale. + # For config reference, see https://github.com/juanfont/headscale/blob/main/config-example.yaml + # To configure any of these as an env: + # 1. Flatten object keys using "_" + # 2. Prefix with "HEADSCALE_" + # + # For example: + # - "listen_addr" becomes "HEADSCALE_LISTEN_ADDR" + # - "log.level" becomes "HEADSCALE_LOG_LEVEL" EOF + fi env: {{- with .Values.ingress.main }}