home-assistant: Manage YAML files with ConfigMap

Editing `configuration.yaml` et al. using `vi` via `kubectl exec` is
rather tedious, since the version of `vi` in the *home-assistant*
container image is very rudimentary.  Thus, I think it would be better
to use a ConfigMap to store the manually-edited YAML files, so I can
edit them with my regular editor on my desktop.  For this to work, the
ConfigMap has to be mounted as a directory rather than as individual
files (using `subPath`), as otherwise the pod would have to be restarted
every time one of the files is updated.
This commit is contained in:
2023-12-27 14:11:51 -06:00
parent 8d796a7c01
commit e56526600d
6 changed files with 368 additions and 0 deletions

View File

@@ -20,6 +20,18 @@ resources:
- ingress.yaml
configMapGenerator:
- name: home-assistant
files:
- configuration.yaml
- groups.yaml
- shell-command.yaml
options:
disableNameSuffixHash: true
labels:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: home-assistant
app.kubernetes.io/part-of: home-assistant
- name: mosquitto
files:
- mosquitto.conf
@@ -48,3 +60,19 @@ patches:
key: username
- name: RECORDER_DB_URL
value: postgresql://$(RECORDER_DB_USERNAME):$(RECORDER_DB_PASSWORD)@default.postgresql/homeassistant
volumeMounts:
- mountPath: /run/config
name: home-assistant-config
readOnly: true
- mountPath: /run/secrets/home-assistant
name: home-assistant-secrets
readOnly: true
volumes:
- name: home-assistant-config
configMap:
name: home-assistant
defaultMode: 0600
- name: home-assistant-secrets
secret:
secretName: home-assistant
defaultMode: 0640