From 28b580499f3cb7077a69c86369e96a324204747e Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Mon, 10 Mar 2025 11:53:18 +0100 Subject: [PATCH] feat(helm): add configurable assets origin Add a helper template to allow customizing the assets origin URL. This gives users the ability to override the default S3 endpoint construction when needed, while maintaining backward compatibility. This can be used when try to use proxy the bucket like cloudfront or some custom domain. Signed-off-by: rjshrjndrn --- .../openreplay/charts/assets/templates/deployment.yaml | 2 +- .../openreplay/charts/sink/templates/deployment.yaml | 2 +- .../charts/sourcemapreader/templates/deployment.yaml | 2 +- scripts/helmcharts/openreplay/templates/_helpers.tpl | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml index eb6e5ce58..ad45f0e70 100644 --- a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml @@ -89,7 +89,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - value: "{{ include "openreplay.s3Endpoint" . }}/{{.Values.global.s3.assetsBucket}}" + value: "{{ include "openreplay.assets_origin" . }}" {{- include "openreplay.env.redis_string" .Values.global.redis | nindent 12 }} ports: {{- range $key, $val := .Values.service.ports }} diff --git a/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml index dc28ed493..c9825fc9a 100644 --- a/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml @@ -65,7 +65,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - value: "{{ include "openreplay.s3Endpoint" . }}/{{.Values.global.s3.assetsBucket}}" + value: {{ include "openreplay.assets_origin" . }} {{- include "openreplay.env.redis_string" .Values.global.redis | nindent 12 }} ports: {{- range $key, $val := .Values.service.ports }} diff --git a/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml index 76c3f7ba7..52a0c2854 100644 --- a/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml @@ -76,7 +76,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - value: "{{ include "openreplay.s3Endpoint" . }}/{{.Values.global.s3.assetsBucket}}" + value: {{ include "openreplay.assets_origin" . }} ports: {{- range $key, $val := .Values.service.ports }} - name: {{ $key }} diff --git a/scripts/helmcharts/openreplay/templates/_helpers.tpl b/scripts/helmcharts/openreplay/templates/_helpers.tpl index 805ab62f5..be8ef934e 100644 --- a/scripts/helmcharts/openreplay/templates/_helpers.tpl +++ b/scripts/helmcharts/openreplay/templates/_helpers.tpl @@ -142,3 +142,11 @@ Create the volume mount config for redis TLS certificates subPath: {{ .tls.certCAFilename }} {{- end }} {{- end }} + +{{- define "openreplay.assets_origin"}} +{{- if .Values.global.assetsOrigin }} +{{- .Values.global.assetsOrigin }} +{{- else }} +{{- include "openreplay.s3Endpoint" . }}/{{.Values.global.s3.assetsBucket}} +{{- end }} +{{- end }}