The delegation nginx serves the .well-known documents from an nginx.conf that is rendered from ingress.domain and mounted with subPath. Changing the domain rewrote the ConfigMap but left the running pod untouched: the pod template was unchanged, so nothing rolled, and the kubelet never refreshes a subPath mount. The pod kept serving the old delegation while looking perfectly healthy - the failure mode from #82. The pod template now carries checksum/config over the rendered delegation ConfigMap, so a changed nginx.conf rolls the deployment. Also documents the limit that remains for homeserver.yaml: it comes from a 1Password-backed Secret, whose content Helm never sees, and the operator's own auto-restart only ever covers Deployments - not this StatefulSet. That case needs a manual rollout restart, which the values.yaml now says out loud. Major bump: runtime behavior changes - a delegation config change now costs a restart of the nginx pod (a few seconds, no persistent state).
63 lines
2.7 KiB
YAML
63 lines
2.7 KiB
YAML
{{- if .Values.matrix.delegation.enabled }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx-deployment
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx-deployment
|
|
spec:
|
|
replicas: {{ include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.matrix.delegation.replicas) }}
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx-deployment
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx-deployment
|
|
annotations:
|
|
# Hash of the rendered delegation ConfigMap: a changed nginx.conf
|
|
# changes the pod template and thus rolls the pods. Without it the
|
|
# running nginx keeps serving the old .well-known documents - the
|
|
# config is mounted with subPath (never refreshed by the kubelet) and
|
|
# nginx reads it only at start.
|
|
checksum/config: {{ include (print $.Template.BasePath "/matrix-delegation-nginx.configmap.yaml") . | sha256sum }}
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
securityContext:
|
|
{{- toYaml .Values.matrix.delegation.securityContext.pod | nindent 8 }}
|
|
containers:
|
|
- name: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx
|
|
image: "{{ .Values.matrix.delegation.image.repository }}:{{ .Values.matrix.delegation.image.tag }}"
|
|
securityContext:
|
|
{{- toYaml .Values.matrix.delegation.securityContext.container | nindent 12 }}
|
|
ports:
|
|
- containerPort: 8080
|
|
name: http
|
|
volumeMounts:
|
|
- name: nginx-config
|
|
mountPath: /etc/nginx/nginx.conf
|
|
subPath: nginx.conf
|
|
# The mounted nginx.conf points the pid file and all temp paths to
|
|
# /tmp, so a single writable emptyDir suffices with a read-only
|
|
# root filesystem.
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
resources:
|
|
{{- include "matrix-synapse.resources" .Values.matrix.delegation.resources | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.matrix.delegation.readinessProbe | nindent 12 }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.matrix.delegation.livenessProbe | nindent 12 }}
|
|
startupProbe:
|
|
{{- toYaml .Values.matrix.delegation.startupProbe | nindent 12 }}
|
|
volumes:
|
|
- name: tmp
|
|
emptyDir: {}
|
|
- name: nginx-config
|
|
configMap:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx-configmap
|
|
items:
|
|
- key: nginx.conf
|
|
path: nginx.conf
|
|
{{- end }}
|