mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-08-28 19:43:12 +00:00
feat: Add support for HA secrets management with init container and configuration options
This commit is contained in:
@@ -25,8 +25,30 @@ spec:
|
|||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.postgres.enabled }}
|
{{- if or .Values.postgres.enabled .Values.haSecrets.enabled }}
|
||||||
initContainers:
|
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
|
- name: init-recorder
|
||||||
image: busybox:latest
|
image: busybox:latest
|
||||||
command:
|
command:
|
||||||
@@ -56,6 +78,7 @@ spec:
|
|||||||
- name: config
|
- name: config
|
||||||
mountPath: /config
|
mountPath: /config
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
@@ -101,6 +124,11 @@ spec:
|
|||||||
path: {{ .Values.persistence.media.hostPath }}
|
path: {{ .Values.persistence.media.hostPath }}
|
||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.haSecrets.enabled }}
|
||||||
|
- name: ha-secrets
|
||||||
|
secret:
|
||||||
|
secretName: {{ .Values.haSecrets.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.nodeSelector }}
|
{{- with .Values.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ persistence:
|
|||||||
hostPath: /srv/data/home-assistant/media
|
hostPath: /srv/data/home-assistant/media
|
||||||
mountPath: /media
|
mountPath: /media
|
||||||
|
|
||||||
|
haSecrets:
|
||||||
|
enabled: false
|
||||||
|
# K8s Secret containing key-value pairs to write as /config/secrets.yaml
|
||||||
|
existingSecret: ""
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
enabled: false
|
enabled: false
|
||||||
host: postgres-tcp.postgres.svc.cluster.local
|
host: postgres-tcp.postgres.svc.cluster.local
|
||||||
|
|||||||
Reference in New Issue
Block a user