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
+34 -1
View File
@@ -37,6 +37,39 @@ spec:
volumeMounts:
- name: 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 }}
- name: init-secrets
image: busybox:latest
@@ -100,7 +133,7 @@ spec:
exec /init
ports:
- name: http
containerPort: 8123
containerPort: {{ .Values.http.server_port }}
protocol: TCP
{{- if .Values.homekit.enabled }}
- name: homekit