Files
rhema-claw/deploy/helm/rhema-claw/templates/deployment.yaml
T
vhaudiquet b9a633d0eb
ci / test (push) Successful in 1m13s
ci / docker (push) Successful in 2m3s
android / debug (push) Successful in 2m32s
android / release (push) Successful in 2m35s
ci / checks (push) Successful in 3m4s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 15s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 2m10s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 10s
ci / publish-edge-chart (push) Successful in 4s
fix(claw): keep one daemon through a rollout
The chart asserts one replica and left the default RollingUpdate, which
starts the new pod before the old one is gone. On this cluster both land
on one node, where Longhorn lets the second mount the read-write-once
volume, so an upgrade ran two daemons over one SQLite store for the
seconds in between.

Boot recovery reads the leases it finds as the turns a dead process
left and releases them as superseded, which holds only while one daemon
writes the file. A second daemon booting beside a live one would take
its turns out from under it.

Recreate ends the old pod first. The daemon handles SIGTERM now, so it
cuts the turn in flight and writes it back before the next pod starts.

helm lint --strict and the template render pass.
2026-12-02 12:36:59 +01:00

109 lines
3.7 KiB
YAML

{{- include "rhema-claw.assertSingleReplica" . }}
{{- /* The daemon binds 0.0.0.0 in-cluster (the Service needs every
interface) and refuses to serve a non-loopback surface without a
bearer token — fail the render here, before the pod does. */ -}}
{{- if not .Values.token }}
{{- fail "token is required: the daemon binds all interfaces in-cluster, and it refuses to serve a non-loopback surface without a bearer token (set `token` in values)" }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "rhema-claw.fullname" . }}
labels:
{{- include "rhema-claw.labels" . | nindent 4 }}
spec:
replicas: 1
# One writer at a time. The default RollingUpdate starts the new pod
# before the old one is gone, and on this cluster both land on one
# node, where Longhorn lets the second mount the read-write-once
# volume: two daemons share the store for the seconds in between.
# Boot recovery assumes the leases it finds name a process that died,
# so the second daemon would take the first one's live turns out from
# under it. Recreate keeps that assumption true.
strategy:
type: Recreate
selector:
matchLabels:
{{- include "rhema-claw.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: server
template:
metadata:
labels:
{{- include "rhema-claw.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: server
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
# The image runs as uid 1000; fsGroup makes the PVC writable by it.
fsGroup: 1000
containers:
- name: claw
image: "{{ .Values.image.repository }}:{{ include "rhema-claw.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --config
- /config/claw.yaml
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 2
periodSeconds: 5
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- if or .Values.secret.existingSecret .Values.secret.stringData }}
envFrom:
- secretRef:
name: {{ .Values.secret.existingSecret | default (include "rhema-claw.fullname" .) }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: data
mountPath: /data
volumes:
- name: config
configMap:
name: {{ include "rhema-claw.fullname" . }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "rhema-claw.fullname" . }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}