mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-08-28 03:27:08 +00:00
feat: Add HTTP configuration options for Home Assistant Helm chart
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -11,7 +11,7 @@ spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: 8123
|
||||
targetPort: {{ .Values.http.server_port }}
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
|
||||
Reference in New Issue
Block a user