Skip to content

Commit 24679bd

Browse files
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67dTyler Longwell
andcommitted
feat(chart): use per-pod emptyDir git scratch when persistence disabled
The relay's git working dir (`BUZZ_GIT_REPO_PATH`) is ephemeral scratch — reads/writes hydrate repos from object storage per request and repo-name uniqueness lives in Postgres, so nothing durable lives on this disk. Before: `persistence.git.enabled: true` mounted a PVC; `false` mounted *nothing*, leaving the git path pointing at an unmounted directory. And a single ReadWriteOnce PVC on a Deployment can only attach to one node, so it cannot back a multi-replica relay across nodes despite the git data being disposable. Now: `enabled: false` mounts a per-pod `emptyDir` at the same mountPath — true per-pod scratch with no shared volume to multi-attach, so the relay scales to N replicas cleanly. `enabled: true` still renders the PVC exactly as before (backward compatible). - deployment.yaml: git-repos volume is always mounted; PVC when enabled, emptyDir when disabled. - values.yaml: document both modes; drop the misleading "RWO is fine at any replicaCount" note (true only for disposability, not scheduling). - render_test.yaml: assert the emptyDir + no-PVC path at replicaCount=5. - Chart 0.1.1 -> 0.1.2. Verified: `helm unittest` 31/31; `helm template` renders emptyDir (0 PVC docs) when disabled and the PVC when enabled. Co-authored-by: Tyler Longwell <[email protected]> Signed-off-by: Tyler Longwell <[email protected]>
1 parent 9f2a11b commit 24679bd

4 files changed

Lines changed: 49 additions & 7 deletions

File tree

‎deploy/charts/buzz/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: |
77
PostgreSQL and Redis. Configurable for single-node evaluation
88
(subcharts on) and HA production (external services, existingSecret).
99
type: application
10-
version: 0.1.1
10+
version: 0.1.2
1111
appVersion: "0.1.0"
1212
home: https://github.com/block/buzz
1313
sources:

‎deploy/charts/buzz/templates/deployment.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ spec:
164164
{{- toYaml .Values.relay.resources | nindent 12 }}
165165

166166
volumeMounts:
167-
{{- if .Values.persistence.git.enabled }}
168167
- { name: git-repos, mountPath: {{ .Values.persistence.git.mountPath | quote }} }
169-
{{- end }}
170168

171169
volumes:
172-
{{- if .Values.persistence.git.enabled }}
173170
- name: git-repos
171+
{{- if .Values.persistence.git.enabled }}
174172
persistentVolumeClaim:
175173
claimName: {{ default (printf "%s-git" (include "buzz.fullname" .)) .Values.persistence.git.existingClaim }}
174+
{{- else }}
175+
emptyDir: {}
176176
{{- end }}

‎deploy/charts/buzz/tests/render_test.yaml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,38 @@ tests:
101101
name: BUZZ_HUDDLE_AUDIO_AVAILABLE
102102
value: "false"
103103
template: templates/deployment.yaml
104+
105+
- it: mounts a per-pod emptyDir git scratch volume when persistence is disabled
106+
set:
107+
relayUrl: wss://buzz.example.com
108+
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
109+
externalPostgresql.url: postgres://u:p@h:5432/d
110+
externalRedis.url: redis://h:6379
111+
s3.endpoint: http://minio:9000
112+
s3.accessKey: a
113+
s3.secretKey: s
114+
replicaCount: 5
115+
persistence.git.enabled: false
116+
asserts:
117+
- equal:
118+
path: spec.replicas
119+
value: 5
120+
template: templates/deployment.yaml
121+
# git-repos is still mounted (BUZZ_GIT_REPO_PATH must be a real dir)…
122+
- contains:
123+
path: spec.template.spec.containers[0].volumeMounts
124+
content:
125+
name: git-repos
126+
mountPath: /var/lib/buzz/git
127+
template: templates/deployment.yaml
128+
# …but as a per-pod emptyDir, not a shared PVC (no multi-attach).
129+
- contains:
130+
path: spec.template.spec.volumes
131+
content:
132+
name: git-repos
133+
emptyDir: {}
134+
template: templates/deployment.yaml
135+
# No PVC is rendered at all when persistence is disabled.
136+
- hasDocuments:
137+
count: 0
138+
template: templates/pvc-git.yaml

‎deploy/charts/buzz/values.yaml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,21 @@ httproute:
176176
# ── Git scratch volume ───────────────────────────────────────────────────────
177177
# Ephemeral working space only. No persistent git state lives here — reads/writes
178178
# hydrate ephemeral repos from object storage per request, and repo-name
179-
# uniqueness lives in Postgres. ReadWriteOnce is correct at any replicaCount; a
180-
# ReadWriteMany volume is NOT required for multi-pod.
179+
# uniqueness lives in Postgres.
180+
#
181+
# enabled: true → mount a PVC at mountPath (durable across pod restarts, but a
182+
# single ReadWriteOnce PVC binds to one node, so it does NOT support multi-pod
183+
# scheduling across nodes on a Deployment).
184+
# enabled: false → mount a per-pod emptyDir at mountPath (pure scratch). This is
185+
# the correct choice for multi-replica HA: each pod gets its own local working
186+
# space, nothing is shared, and there is no volume to multi-attach. Safe
187+
# because the object store + Postgres are the sources of truth, not this disk.
181188
persistence:
182189
git:
183190
enabled: true
184191
mountPath: /var/lib/buzz/git
185192
storageClass: ""
186-
accessMode: ReadWriteOnce # RWO is fine at any replicaCount (object-store-backed git)
193+
accessMode: ReadWriteOnce
187194
size: 10Gi
188195
annotations: {}
189196
existingClaim: ""

0 commit comments

Comments
 (0)