image: repository: tccr.io/truecharts/home-assistant pullPolicy: IfNotPresent tag: v2023.7.1@sha256:1a5689f2c9904c12e7d8df9e7431fcdd593f9eb4e3e4bbee5a769fb93158d1aa service: main: ports: main: port: 8123 targetPort: 8123 workload: main: podSpec: initContainers: init: type: init enabled: true imageSelector: image command: /config/init/init.sh # # Enable devices to be discoverable # hostNetwork: true # # When hostNetwork is true set dnsPolicy to ClusterFirstWithHostNet # dnsPolicy: ClusterFirstWithHostNet homeassistant: trusted_proxies: [] # Enable a prometheus-operator servicemonitor prometheus: serviceMonitor: enabled: false # interval: 1m # additionalLabels: {} persistence: config: enabled: true mountPath: /config targetSelectAll: true init: enabled: true type: configmap objectName: init mountPath: "/config/init" defaultMode: "0777" readOnly: true targetSelector: main: init: {} configmap: init: enabled: true data: init.sh: |- #!/bin/sh config_file="/config/configuration.yaml" if test -f "$config_file"; then echo "configuration.yaml exists." if grep -q recorder: "$config_file"; then echo "configuration.yaml already contains recorder" else echo "" >> "$config_file" cat /config/init/recorder.default >> "$config_file" fi if grep -q http: "$config_file"; then echo "configuration.yaml already contains http section" else echo "" >> "$config_file" cat /config/init/http.default >> "$config_file" fi else echo "configuration.yaml does NOT exist." cp /config/init/configuration.yaml.default "$config_file" echo "" >> "$config_file" cat /config/init/recorder.default >> "$config_file" echo "" >> "$config_file" cat /config/init/http.default >> "$config_file" echo "" >> "$config_file" fi echo "Creating include files..." for include_file in groups.yaml automations.yaml scripts.yaml scenes.yaml; do if test -f "/config/$include_file"; then echo "$include_file exists." else echo "$include_file does NOT exist." touch "/config/$include_file" fi done cd "/config" || echo "Could not change path to /config" echo "Creating custom_components directory..." mkdir "/config/custom_components" || echo "custom_components directory already exists" echo "Changing to the custom_components directory..." cd "/config/custom_components" || echo "Could not change path to /config/custom_components" echo "Downloading HACS" wget "https://github.com/hacs/integration/releases/latest/download/hacs.zip" || exit 0 if [ -d "/config/custom_components/hacs" ]; then echo "HACS directory already exist, cleaning up..." rm -R "/config/custom_components/hacs" fi echo "Creating HACS directory..." mkdir "/config/custom_components/hacs" echo "Unpacking HACS..." unzip "/config/custom_components/hacs.zip" -d "/config/custom_components/hacs" >/dev/null 2>&1 echo "Removing HACS zip file..." rm "/config/custom_components/hacs.zip" echo "Installation complete." configuration.yaml.default: |- # Configure a default setup of Home Assistant (frontend, api, etc) default_config: # Text to speech tts: - platform: google_translate group: !include groups.yaml automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml recorder.default: |- recorder: purge_keep_days: 30 commit_interval: 3 db_url: {{ (printf "%s?client_encoding=utf8" (.Values.cnpg.main.creds.std | trimAll "\"")) | quote }} http.default: |- http: use_x_forwarded_for: true trusted_proxies: {{- if hasKey .Values "ixChartContext" }} - {{ .Values.ixChartContext.kubernetes_config.cluster_cidr }} {{- else }} {{- range .Values.homeassistant.trusted_proxies }} - {{ . }} {{- end }} {{- end }} cnpg: main: enabled: true user: home-assistant database: home-assistant portal: open: enabled: true securityContext: container: readOnlyRootFilesystem: false runAsNonRoot: false runAsUser: 0 runAsGroup: 0 capabilities: add: - CAP_NET_RAW - CAP_NET_BIND_SERVICE