feat: Add HTTP configuration options for Home Assistant Helm chart

This commit is contained in:
sha
2026-03-30 23:45:14 +03:00
parent 5b16f666a3
commit 7fd9d16626
4 changed files with 46 additions and 2 deletions
+3
View File
@@ -5,6 +5,9 @@ home-assistant:
hostNetwork: false hostNetwork: false
http:
enabled: true
homekit: homekit:
enabled: false enabled: false
+34 -1
View File
@@ -37,6 +37,39 @@ spec:
volumeMounts: volumeMounts:
- name: config - name: config
mountPath: /config mountPath: /config
{{- if .Values.http.enabled }}
- name: init-http
image: busybox:latest
command:
- /bin/sh
- -c
- |
# Build http.yaml — auto-detect pod/service CIDRs from environment
POD_CIDR=$(echo $KUBERNETES_SERVICE_HOST | sed 's/\.[0-9]*$/\.0\/16/')
cat > /config/http.yaml << EOF
server_port: {{ .Values.http.server_port }}
ip_ban_enabled: {{ .Values.http.ip_ban_enabled }}
login_attempts_threshold: {{ .Values.http.login_attempts_threshold }}
use_x_forwarded_for: true
trusted_proxies:
- ${POD_CIDR}
- 127.0.0.1
- "::1"
{{- range .Values.http.extra_trusted_proxies }}
- {{ . | quote }}
{{- end }}
EOF
# Remove leading whitespace from heredoc
sed -i 's/^ //' /config/http.yaml
# Ensure configuration.yaml includes http.yaml
if ! grep -q 'http.yaml' /config/configuration.yaml 2>/dev/null; then
echo "" >> /config/configuration.yaml
echo "http: !include http.yaml" >> /config/configuration.yaml
fi
volumeMounts:
- name: config
mountPath: /config
{{- end }}
{{- if .Values.haSecrets.enabled }} {{- if .Values.haSecrets.enabled }}
- name: init-secrets - name: init-secrets
image: busybox:latest image: busybox:latest
@@ -100,7 +133,7 @@ spec:
exec /init exec /init
ports: ports:
- name: http - name: http
containerPort: 8123 containerPort: {{ .Values.http.server_port }}
protocol: TCP protocol: TCP
{{- if .Values.homekit.enabled }} {{- if .Values.homekit.enabled }}
- name: homekit - name: homekit
+1 -1
View File
@@ -11,7 +11,7 @@ spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port }}
targetPort: 8123 targetPort: {{ .Values.http.server_port }}
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
+8
View File
@@ -72,6 +72,14 @@ persistence:
- ReadWriteOnce - ReadWriteOnce
storageClass: "" storageClass: ""
http:
enabled: false
server_port: 8123
ip_ban_enabled: false
login_attempts_threshold: 5
# Pod/service CIDRs and localhost are auto-detected; add extra entries here
extra_trusted_proxies: []
haSecrets: haSecrets:
enabled: false enabled: false
# K8s Secret containing key-value pairs to write as /config/secrets.yaml # K8s Secret containing key-value pairs to write as /config/secrets.yaml