Skip to content

Commit

Permalink
✨ (headscale): Set path envs to the value of `.persistence.config.mou…
Browse files Browse the repository at this point in the history
…ntPath` instead of hardcoding
  • Loading branch information
gabe565 committed Mar 27, 2023
1 parent 5736598 commit 7ac7eab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion charts/headscale/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An open source, self-hosted implementation of the Tailscale control
home: https://charts.gabe565.com/charts/headscale
icon: https://raw.githubusercontent.com/juanfont/headscale/56a7b1e34952c3e0306a134b2be9b4277f5d8d6e/docs/logo/headscale3-dots.svg
type: application
version: 0.9.1
version: 0.9.2
# renovate datasource=docker depName=ghcr.io/juanfont/headscale
appVersion: 0.21.0
kubeVersion: ">=1.22.0-0"
Expand All @@ -28,3 +28,5 @@ annotations:
artifacthub.io/changes: |-
- kind: changed
description: Don't overwrite config if already exists. Envs are still suggested, but not required anymore.
- kind: changed
description: Set path envs to the value of `.persistence.config.mountPath` instead of hardcoding
2 changes: 1 addition & 1 deletion charts/headscale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://raw.githubusercontent.com/juanfont/headscale/56a7b1e34952c3e0306a134b2be9b4277f5d8d6e/docs/logo/headscale3-dots.svg" align="right" width="92" alt="headscale logo">

![Version: 0.9.1](https://img.shields.io/badge/Version-0.9.1-informational?style=flat)
![Version: 0.9.2](https://img.shields.io/badge/Version-0.9.2-informational?style=flat)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat)
![AppVersion: 0.21.0](https://img.shields.io/badge/AppVersion-0.21.0-informational?style=flat)

Expand Down
15 changes: 9 additions & 6 deletions charts/headscale/templates/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ args: ["headscale", "serve"]
initContainers:
config:
image: alpine
env:
- name: CONFIG_DIR
value: {{ .Values.persistence.config.mountPath }}
volumeMounts:
{{- if .Values.persistence.config.enabled }}
- name: config
mountPath: /etc/headscale
mountPath: {{ .Values.persistence.config.mountPath }}
{{- end }}
command:
- sh
- -c
- |
if [[ -f '/etc/headscale/config.yaml' ]]; then
if [[ -f "$CONFIG_DIR/config.yaml" ]]; then
echo 'Config already exists' >&2
else
echo 'Writing empty config' >&2
cat <<- 'EOF' >/etc/headscale/config.yaml
cat <<- 'EOF' >"$CONFIG_DIR/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:
Expand All @@ -43,9 +46,9 @@ env:
HEADSCALE_METRICS_LISTEN_ADDR: "0.0.0.0:{{ .metrics.port }}"
{{- end }}

HEADSCALE_PRIVATE_KEY_PATH: "/etc/headscale/private.key"
HEADSCALE_PRIVATE_KEY_PATH: "{{ .Values.persistence.config.mountPath }}/private.key"
HEADSCALE_NOISE: "{}"
HEADSCALE_NOISE_PRIVATE_KEY_PATH: "/etc/headscale/noise_private.key"
HEADSCALE_NOISE_PRIVATE_KEY_PATH: "{{ .Values.persistence.config.mountPath }}/noise_private.key"

HEADSCALE_IP_PREFIXES: "fd7a:115c:a1e0::/48 100.64.0.0/10"

Expand All @@ -72,7 +75,7 @@ env:
key: {{ if not .auth.password }}postgres-{{ end }}password
{{- else }}
HEADSCALE_DB_TYPE: "sqlite3"
HEADSCALE_DB_PATH: "/etc/headscale/db.sqlite"
HEADSCALE_DB_PATH: "{{ $.Values.persistence.config.mountPath }}/db.sqlite"
{{- end }}
{{- end }}
{{- end -}}
Expand Down

0 comments on commit 7ac7eab

Please sign in to comment.