Skip to content

Commit f70ce00

Browse files
LudvigHzclaude
andcommitted
feat(lago): add GCS support and stop provisioning the local PVC for it
The chart had no GCS awareness, and the bundled local-storage PVC was gated only on S3 and MinIO. For anyone running Lago against Google Cloud Storage that gate is always true, so the chart provisions one ReadWriteOnce PVC and mounts it at /app/storage into api, worker, billing-worker, payment-worker, pdf-worker and clock-worker. A single RWO disk attaches to one node, so all six pods must co-locate. That holds by luck on first install and then any rollout that schedules a pod onto another node deadlocks with Multi-Attach errors, on a volume that is never read or written while object storage is active. Add a global.gcs block mirroring global.s3, a gcsEnvs helper following the existing kafkaEnvs/clickhouseEnvs pattern, and a localStorage helper that answers "is the bundled PVC needed?" in one place instead of an inline condition repeated across 13 sites. Wire gcsEnvs into the same six deployments that already carry the S3 env block. Rendered output is unchanged for anyone who has not set global.gcs.enabled, verified with a before/after helm template diff across the default, s3, minio, clickhouse and existingSecret value sets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d473b1e commit f70ce00

11 files changed

Lines changed: 283 additions & 14 deletions

charts/lago/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "1.32.4"
33
description: the Lago open source billing app
44
name: lago
5-
version: 1.28.0
5+
version: 1.29.0
66
dependencies:
77
- name: minio
88
version: "5.2.0"

charts/lago/templates/_helpers.tpl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,34 @@
8585
key: clickhousePassword
8686
optional: true
8787
{{- end }}
88+
89+
{{- define "gcsEnvs" }}
90+
{{- $gcs := .Values.global.gcs -}}
91+
- name: LAGO_USE_GCS
92+
value: "true"
93+
- name: LAGO_GCS_PROJECT
94+
value: {{ required "If gcs is enabled, you must provide global.gcs.project" $gcs.project | quote }}
95+
- name: LAGO_GCS_BUCKET
96+
value: {{ required "If gcs is enabled, you must provide global.gcs.bucket" $gcs.bucket | quote }}
97+
{{- if $gcs.iam }}
98+
- name: LAGO_GCS_IAM
99+
value: "true"
100+
- name: LAGO_GCS_GSA_EMAIL
101+
value: {{ required "If gcs iam is enabled, you must provide global.gcs.gsaEmail" $gcs.gsaEmail | quote }}
102+
{{- end }}
103+
{{- with $gcs.keyfileJsonPath }}
104+
- name: LAGO_GCS_KEYFILE_JSON_PATH
105+
value: {{ . | quote }}
106+
{{- end }}
107+
{{- end }}
108+
109+
{{/*
110+
Renders "true" when no object storage backend is configured, meaning the chart
111+
has to provision and mount its bundled local-storage PersistentVolumeClaim.
112+
Empty (falsy) otherwise, so it can be used as {{ if include "localStorage" . }}.
113+
*/}}
114+
{{- define "localStorage" -}}
115+
{{- if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) (not .Values.global.gcs.enabled) -}}
116+
true
117+
{{- end -}}
118+
{{- end }}

charts/lago/templates/api-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ spec:
200200
{{ default "us-east-1" .Values.minio.region | quote }}
201201
{{ end }}
202202
{{ end }}
203+
{{- if .Values.global.gcs.enabled }}
204+
{{- include "gcsEnvs" . | nindent 12 }}
205+
{{- end }}
203206
{{ if .Values.global.smtp.enabled }}
204207
- name: LAGO_FROM_EMAIL
205208
value: {{ .Values.global.smtp.fromEmail }}
@@ -265,13 +268,13 @@ spec:
265268
resources:
266269
{{- toYaml . | nindent 12}}
267270
{{- end }}
268-
{{- if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
271+
{{- if include "localStorage" . }}
269272
volumeMounts:
270273
- mountPath: /app/storage
271274
name: {{ .Release.Name }}-storage-data
272275
{{ end }}
273276
restartPolicy: Always
274-
{{- if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
277+
{{- if include "localStorage" . }}
275278
volumes:
276279
- name: {{ .Release.Name }}-storage-data
277280
persistentVolumeClaim:

charts/lago/templates/billing-worker-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ spec:
182182
{{ default "us-east-1" .Values.minio.region | quote }}
183183
{{ end }}
184184
{{ end }}
185+
{{- if .Values.global.gcs.enabled }}
186+
{{- include "gcsEnvs" . | nindent 12 }}
187+
{{- end }}
185188

186189
{{ if .Values.global.smtp.enabled }}
187190
- name: LAGO_FROM_EMAIL
@@ -224,13 +227,13 @@ spec:
224227
resources:
225228
{{- toYaml . | nindent 12}}
226229
{{- end }}
227-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
230+
{{ if include "localStorage" . }}
228231
volumeMounts:
229232
- mountPath: /app/storage
230233
name: {{ .Release.Name }}-storage-data
231234
{{ end }}
232235
restartPolicy: Always
233-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
236+
{{ if include "localStorage" . }}
234237
volumes:
235238
- name: {{ .Release.Name }}-storage-data
236239
persistentVolumeClaim:

charts/lago/templates/clock-worker-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ spec:
182182
{{ default "us-east-1" .Values.minio.region | quote }}
183183
{{ end }}
184184
{{ end }}
185+
{{- if .Values.global.gcs.enabled }}
186+
{{- include "gcsEnvs" . | nindent 12 }}
187+
{{- end }}
185188

186189
{{ if .Values.global.newRelic.enabled }}
187190
- name: NEW_RELIC_KEY
@@ -206,13 +209,13 @@ spec:
206209
resources:
207210
{{- toYaml . | nindent 12}}
208211
{{- end }}
209-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
212+
{{ if include "localStorage" . }}
210213
volumeMounts:
211214
- mountPath: /app/storage
212215
name: {{ .Release.Name }}-storage-data
213216
{{ end }}
214217
restartPolicy: Always
215-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
218+
{{ if include "localStorage" . }}
216219
volumes:
217220
- name: {{ .Release.Name }}-storage-data
218221
persistentVolumeClaim:

charts/lago/templates/payment-worker-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ spec:
182182
{{ default "us-east-1" .Values.minio.region | quote }}
183183
{{ end }}
184184
{{ end }}
185+
{{- if .Values.global.gcs.enabled }}
186+
{{- include "gcsEnvs" . | nindent 12 }}
187+
{{- end }}
185188

186189
{{ if .Values.global.smtp.enabled }}
187190
- name: LAGO_FROM_EMAIL
@@ -224,13 +227,13 @@ spec:
224227
resources:
225228
{{- toYaml . | nindent 12}}
226229
{{- end }}
227-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
230+
{{ if include "localStorage" . }}
228231
volumeMounts:
229232
- mountPath: /app/storage
230233
name: {{ .Release.Name }}-storage-data
231234
{{ end }}
232235
restartPolicy: Always
233-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
236+
{{ if include "localStorage" . }}
234237
volumes:
235238
- name: {{ .Release.Name }}-storage-data
236239
persistentVolumeClaim:

charts/lago/templates/pdf-worker-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ spec:
182182
{{ default "us-east-1" .Values.minio.region | quote }}
183183
{{ end }}
184184
{{ end }}
185+
{{- if .Values.global.gcs.enabled }}
186+
{{- include "gcsEnvs" . | nindent 12 }}
187+
{{- end }}
185188

186189
{{ if .Values.global.smtp.enabled }}
187190
- name: LAGO_FROM_EMAIL
@@ -224,13 +227,13 @@ spec:
224227
resources:
225228
{{- toYaml . | nindent 12}}
226229
{{- end }}
227-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
230+
{{ if include "localStorage" . }}
228231
volumeMounts:
229232
- mountPath: /app/storage
230233
name: {{ .Release.Name }}-storage-data
231234
{{ end }}
232235
restartPolicy: Always
233-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
236+
{{ if include "localStorage" . }}
234237
volumes:
235238
- name: {{ .Release.Name }}-storage-data
236239
persistentVolumeClaim:

charts/lago/templates/storage-data-persistentvolumeclaim.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) -}}
1+
{{- if include "localStorage" . -}}
22
apiVersion: v1
33
kind: PersistentVolumeClaim
44
metadata:

charts/lago/templates/worker-deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ spec:
181181
{{ default "us-east-1" .Values.minio.region | quote }}
182182
{{ end }}
183183
{{ end }}
184+
{{- if .Values.global.gcs.enabled }}
185+
{{- include "gcsEnvs" . | nindent 12 }}
186+
{{- end }}
184187

185188
{{ if .Values.global.smtp.enabled }}
186189
- name: LAGO_FROM_EMAIL
@@ -223,13 +226,13 @@ spec:
223226
resources:
224227
{{- toYaml . | nindent 12}}
225228
{{- end }}
226-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
229+
{{ if include "localStorage" . }}
227230
volumeMounts:
228231
- mountPath: /app/storage
229232
name: {{ .Release.Name }}-storage-data
230233
{{ end }}
231234
restartPolicy: Always
232-
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
235+
{{ if include "localStorage" . }}
233236
volumes:
234237
- name: {{ .Release.Name }}-storage-data
235238
persistentVolumeClaim:

0 commit comments

Comments
 (0)