37 lines
1.4 KiB
YAML
37 lines
1.4 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: homeassistant-config-setup
|
|
spec:
|
|
template:
|
|
spec:
|
|
restartPolicy: Never
|
|
containers:
|
|
- name: config-setup
|
|
image: busybox:1.35
|
|
command: ['sh', '-c']
|
|
args:
|
|
- |
|
|
# Wait for config file to exist
|
|
while [ ! -f /config/configuration.yaml ]; do
|
|
sleep 5
|
|
done
|
|
|
|
# Add HTTP config if not present
|
|
if ! grep -q "use_x_forwarded_for" /config/configuration.yaml; then
|
|
echo "" >> /config/configuration.yaml
|
|
echo "# HTTP configuration for reverse proxy support" >> /config/configuration.yaml
|
|
echo "http:" >> /config/configuration.yaml
|
|
echo " use_x_forwarded_for: true" >> /config/configuration.yaml
|
|
echo " trusted_proxies:" >> /config/configuration.yaml
|
|
echo " - 10.0.0.0/8" >> /config/configuration.yaml
|
|
echo " - 172.16.0.0/12" >> /config/configuration.yaml
|
|
echo " - 192.168.0.0/16" >> /config/configuration.yaml
|
|
fi
|
|
volumeMounts:
|
|
- mountPath: /config
|
|
name: homeassistant-config
|
|
volumes:
|
|
- name: homeassistant-config
|
|
persistentVolumeClaim:
|
|
claimName: homeassistant-pvc |