From 169b054dff2c84ede7d34bab3f010068d6b1e82a Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 12 Nov 2024 12:41:47 +0100 Subject: [PATCH] fixed working version --- charts/home-assistant/Chart.yaml | 2 +- charts/home-assistant/README.md | 9 ++- .../templates/configuration.yaml | 7 ++ charts/home-assistant/templates/secrets.yaml | 11 +++ charts/home-assistant/values.yaml | 72 +++++++++++++++++-- 5 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 charts/home-assistant/templates/configuration.yaml create mode 100644 charts/home-assistant/templates/secrets.yaml diff --git a/charts/home-assistant/Chart.yaml b/charts/home-assistant/Chart.yaml index c245307..db38063 100644 --- a/charts/home-assistant/Chart.yaml +++ b/charts/home-assistant/Chart.yaml @@ -16,4 +16,4 @@ maintainers: dependencies: - name: lib repository: https://git.rre.nu/api/packages/jonas/helm - version: 1.0.3 + version: 1.0.4 diff --git a/charts/home-assistant/README.md b/charts/home-assistant/README.md index dfc1bc4..d75c69c 100644 --- a/charts/home-assistant/README.md +++ b/charts/home-assistant/README.md @@ -25,11 +25,18 @@ The following table lists the configurable parameters of the Home-assistant char | `ingress.hosts` | | `[{"host": "example.local", "paths": [{"path": "/", "pathType": "Prefix"}]}]` | | `ingress.annotations` | | `{}` | | `ingress.tls` | | `[]` | -| `volumeClaimTemplates` | | `[{"name": "config", "mountPath": "/config", "accessMode": "ReadWriteOnce", "storageClassName": "default", "size": "1Gi"}]` | +| `volumeClaimTemplates` | | `[{"name": "config", "mountPath": "/config", "accessMode": "ReadWriteOnce", "storageClassName": "longhorn", "size": "1Gi"}]` | | `livenessProbe.httpGet.path` | | `"/"` | | `livenessProbe.httpGet.port` | | `8123` | | `livenessProbe.initialDelaySeconds` | | `5` | | `livenessProbe.periodSeconds` | | `3` | +| `volumes` | | `[{"name": "configs", "configMap": {"name": "hass-configs", "items": [{"key": "configuration.yaml", "path": "configuration.yaml"}, {"key": "automations.yaml", "path": "automations.yaml"}, {"key": "scenes.yaml", "path": "scenes.yaml"}, {"key": "scripts.yaml", "path": "scripts.yaml"}]}}, {"name": "secrets", "secret": {"secretName": "hass-secrets", "items": [{"key": "secrets.yaml", "path": "secrets.yaml"}]}}]` | +| `volumeMounts` | | `[{"name": "configs", "mountPath": "/config/configuration.yaml", "subPath": "configuration.yaml", "readOnly": true}, {"name": "configs", "mountPath": "/config/automations.yaml", "subPath": "automations.yaml", "readOnly": true}, {"name": "configs", "mountPath": "/config/scenes.yaml", "subPath": "scenes.yaml", "readOnly": true}, {"name": "configs", "mountPath": "/config/scripts.yaml", "subPath": "scripts.yaml", "readOnly": true}, {"name": "secrets", "mountPath": "/config/secrets.yaml", "subPath": "secrets.yaml", "readOnly": true}]` | +| `hass_configs.configuration.yaml` | | `"# Loads default set of integrations. Do not remove.\ndefault_config:\n\n# Load frontend themes from the themes folder\nfrontend:\n themes: !include_dir_merge_named themes\n\nautomation: !include automations.yaml\nscript: !include scripts.yaml\nscene: !include scenes.yaml\n"` | +| `hass_configs.automations.yaml` | | `"[]\n"` | +| `hass_configs.scenes.yaml` | | `"# scenes\n"` | +| `hass_configs.scripts.yaml` | | `"# scripts\n"` | +| `hass_secrets.secrets.yaml` | | `"# Use this file to store secrets like usernames and passwords.\n# Learn more at https://www.home-assistant.io/docs/configuration/secrets/\nsome_password: welcome\n"` | diff --git a/charts/home-assistant/templates/configuration.yaml b/charts/home-assistant/templates/configuration.yaml new file mode 100644 index 0000000..fe05283 --- /dev/null +++ b/charts/home-assistant/templates/configuration.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: hass-configs + namespace: {{ .Values.namespace | default "default" }} + labels: {{ include "lib.labels" . | nindent 4 }} +data: {{ .Values.hass_configs | toYaml | nindent 2 }} diff --git a/charts/home-assistant/templates/secrets.yaml b/charts/home-assistant/templates/secrets.yaml new file mode 100644 index 0000000..42a94bb --- /dev/null +++ b/charts/home-assistant/templates/secrets.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: hass-secrets + namespace: {{ .Values.namespace | default "default" }} + labels: {{ include "lib.labels" . | nindent 4 }} +type: Opauge +data: + {{- range $n, $v := .Values.hass_secrets -}} + {{ $n | nindent 2 }}: {{ $v | b64enc }} + {{- end }} diff --git a/charts/home-assistant/values.yaml b/charts/home-assistant/values.yaml index 1433e61..7bc2b57 100644 --- a/charts/home-assistant/values.yaml +++ b/charts/home-assistant/values.yaml @@ -1,4 +1,3 @@ - image: repository: ghcr.io/home-assistant/home-assistant tag: @@ -32,18 +31,83 @@ ingress: # hosts: # - chart-example.local - volumeClaimTemplates: - name: config mountPath: /config accessMode: "ReadWriteOnce" - storageClassName: "default" + storageClassName: "longhorn" size: 1Gi - livenessProbe: httpGet: path: / port: 8123 initialDelaySeconds: 5 periodSeconds: 3 + +volumes: + - name: configs + configMap: + name: hass-configs + items: + - key: configuration.yaml + path: configuration.yaml + - key: automations.yaml + path: automations.yaml + - key: scenes.yaml + path: scenes.yaml + - key: scripts.yaml + path: scripts.yaml + - name: secrets + secret: + secretName: hass-secrets + items: + - key: secrets.yaml + path: secrets.yaml + +volumeMounts: + - name: configs + mountPath: /config/configuration.yaml + subPath: configuration.yaml + readOnly: true + - name: configs + mountPath: /config/automations.yaml + subPath: automations.yaml + readOnly: true + - name: configs + mountPath: /config/scenes.yaml + subPath: scenes.yaml + readOnly: true + - name: configs + mountPath: /config/scripts.yaml + subPath: scripts.yaml + readOnly: true + - name: secrets + mountPath: /config/secrets.yaml + subPath: secrets.yaml + readOnly: true + +hass_configs: + configuration.yaml: | + # Loads default set of integrations. Do not remove. + default_config: + + # Load frontend themes from the themes folder + frontend: + themes: !include_dir_merge_named themes + + automation: !include automations.yaml + script: !include scripts.yaml + scene: !include scenes.yaml + automations.yaml: | + [] + scenes.yaml: | + # scenes + scripts.yaml: | + # scripts + +hass_secrets: + secrets.yaml: | + # Use this file to store secrets like usernames and passwords. + # Learn more at https://www.home-assistant.io/docs/configuration/secrets/ + some_password: welcome