feat: Add support for HA secrets management with init container and configuration options

This commit is contained in:
sha
2026-03-18 14:37:28 +02:00
parent c632968e49
commit 83e9c35f19
2 changed files with 34 additions and 1 deletions
+29 -1
View File
@@ -25,8 +25,30 @@ spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
{{- if .Values.postgres.enabled }}
{{- if or .Values.postgres.enabled .Values.haSecrets.enabled }}
initContainers:
{{- if .Values.haSecrets.enabled }}
- name: init-secrets
image: busybox:latest
command:
- /bin/sh
- -c
- |
# Build secrets.yaml from mounted K8s secret
echo "# Managed by Helm - do not edit manually" > /config/secrets.yaml
for f in /ha-secrets/*; do
key=$(basename "$f")
val=$(cat "$f")
echo "$key: \"$val\"" >> /config/secrets.yaml
done
volumeMounts:
- name: config
mountPath: /config
- name: ha-secrets
mountPath: /ha-secrets
readOnly: true
{{- end }}
{{- if .Values.postgres.enabled }}
- name: init-recorder
image: busybox:latest
command:
@@ -55,6 +77,7 @@ spec:
volumeMounts:
- name: config
mountPath: /config
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
@@ -101,6 +124,11 @@ spec:
path: {{ .Values.persistence.media.hostPath }}
type: DirectoryOrCreate
{{- end }}
{{- if .Values.haSecrets.enabled }}
- name: ha-secrets
secret:
secretName: {{ .Values.haSecrets.existingSecret }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
+5
View File
@@ -60,6 +60,11 @@ persistence:
hostPath: /srv/data/home-assistant/media
mountPath: /media
haSecrets:
enabled: false
# K8s Secret containing key-value pairs to write as /config/secrets.yaml
existingSecret: ""
postgres:
enabled: false
host: postgres-tcp.postgres.svc.cluster.local