Home Assistant reads configuration.yaml, http-config.yaml and recorder-config.yaml from a 1Password-backed Secret, mounted with subPath. Two different gaps hide behind that, and only one of them can be closed. Repointing secrets.configSecretRef at a different vault item used to leave the running pod on the old configuration. That is now covered: the pod template carries checksum/secret-ref over the rendered OnePasswordItem. The annotation is named apart from checksum/config on purpose - it only promises that the config source changed, not the config itself - matching the pattern minecraft-server introduced. Changing the CONTENT of the item in the vault still does not restart anything, and cannot: Helm never sees the content, so there is nothing to hash. The operator's own auto-restart annotation is no way out either - onepassword- operator 1.12.0 enumerates exactly one workload type in its secret-update handler (appsv1.DeploymentList) and this workload is a StatefulSet, so the annotation would be a silent no-op advertising a guarantee it cannot keep. It is deliberately not set. values.yaml states the limitation and the manual rollout restart it requires; the README guideline records the operator finding, the annotation precedence trap, and the checksum/secret-ref pattern so neither is rediscovered the hard way. Major bump: runtime behavior changes - changing the secret reference now costs a restart. For this release the effect is preventive, since it currently runs at zero replicas via scaleDown.
120 lines
5.0 KiB
YAML
120 lines
5.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: "{{ .Release.Name }}-{{ .Chart.Name }}-sfs"
|
|
labels:
|
|
app: "{{ .Release.Name }}-{{ .Chart.Name }}"
|
|
spec:
|
|
serviceName: "{{ .Release.Name }}-{{ .Chart.Name }}-service"
|
|
replicas: {{ include "homeassistant.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.replicas) }}
|
|
selector:
|
|
matchLabels:
|
|
app: "{{ .Release.Name }}-{{ .Chart.Name }}"
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: "{{ .Release.Name }}-{{ .Chart.Name }}"
|
|
name: "{{ .Release.Name }}-{{ .Chart.Name }}-sfs"
|
|
annotations:
|
|
# Deliberately NOT a hash of the secret's content: the Kubernetes Secret
|
|
# is materialized by the 1Password operator, so Helm never sees what is
|
|
# in it. This hash covers the rendered OnePasswordItem, i.e. the op://
|
|
# item path - repointing secrets.configSecretRef at a different item now
|
|
# takes effect instead of silently leaving the old configuration in the
|
|
# running pod. A change of the item's CONTENT inside the vault is not
|
|
# covered; see the comment on secrets in values.yaml for why that gap
|
|
# cannot be closed here and what it means operationally.
|
|
# The name differs from checksum/config on purpose - that one promises
|
|
# "the config changed", this one only "the config source changed".
|
|
checksum/secret-ref: {{ include (print $.Template.BasePath "/homeassistant-core-config.secret.yaml") . | sha256sum }}
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext.pod | nindent 8 }}
|
|
containers:
|
|
- name: "{{ .Release.Name }}-{{ .Chart.Name }}"
|
|
image: "ghcr.io/home-assistant/home-assistant:{{ .Chart.AppVersion }}"
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext.container | nindent 12 }}
|
|
env:
|
|
- name: TZ
|
|
value: "{{ .Values.core.timezone }}"
|
|
{{- range $value := .Values.env }}
|
|
{{- if $value.value }}
|
|
- name: {{ $value.name | quote }}
|
|
value: {{ tpl $value.value $ | quote }}
|
|
{{- else if $value.valueFrom }}
|
|
{{- if $value.valueFrom.secretKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ tpl $value.valueFrom.secretKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.secretKeyRef.key $ | quote }}
|
|
{{- else if $value.valueFrom.configMapKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 8123
|
|
protocol: TCP
|
|
livenessProbe:
|
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
|
startupProbe:
|
|
{{- toYaml .Values.startupProbe | nindent 12 }}
|
|
resources:
|
|
{{- include "homeassistant.resources" .Values.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- mountPath: /config/configuration.yaml
|
|
subPath: configuration.yaml
|
|
name: core-config
|
|
- mountPath: /config/http-config.yaml
|
|
subPath: http-config.yaml
|
|
name: http-config
|
|
- mountPath: /config/recorder-config.yaml
|
|
subPath: recorder-config.yaml
|
|
name: recorder-config
|
|
- mountPath: /config
|
|
name: hass-volume
|
|
subPath: hass-config
|
|
# Writable emptyDirs so the root filesystem can stay read-only:
|
|
# s6-overlay needs /run, Home Assistant writes temp files to /tmp.
|
|
- mountPath: /tmp
|
|
name: tmp
|
|
- mountPath: /run
|
|
name: run
|
|
volumes:
|
|
- name: tmp
|
|
emptyDir: {}
|
|
- name: run
|
|
emptyDir: {}
|
|
- name: core-config
|
|
secret:
|
|
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-config-secret
|
|
items:
|
|
- key: config
|
|
path: configuration.yaml
|
|
- name: http-config
|
|
secret:
|
|
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-config-secret
|
|
items:
|
|
- key: http-config
|
|
path: http-config.yaml
|
|
- name: recorder-config
|
|
secret:
|
|
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-config-secret
|
|
items:
|
|
- key: recorder-config
|
|
path: recorder-config.yaml
|
|
- name: hass-volume
|
|
persistentVolumeClaim:
|
|
claimName: {{ .Release.Name }}-{{ .Chart.Name }}-pvc
|
|
# TODO: bind to local nodes |