set env variables on helm-deployed apps so that they work as expected

Signed-off-by: Pascal Sthamer <pascal+github@sthamer.xyz>
This commit is contained in:
Pascal Sthamer
2025-12-05 16:00:13 +01:00
parent 82edd747ad
commit fb07662d7a
2 changed files with 25 additions and 8 deletions
@@ -120,6 +120,16 @@ spec:
args: {{- include "common.tplvalues.render" (dict "value" $appValues.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: AUTHORIZATION
value: ""
- name: EXECUTIONID
value: ""
- name: BASE_URL
value: {{ include "shuffle.worker.baseUrl" $ | quote }}
- name: CALLBACK_URL
value: {{ include "shuffle.backend.baseUrl" $ | quote }}
- name: SHUFFLE_SWARM_CONFIG
value: run # Shuffle Worker requires this to be set even when using K8s instead of swarm
{{- $env := include "shuffle.appInstance.env" $ | fromYaml }}
{{- range $key, $val := $env }}
- name: {{ $key | quote }}
@@ -302,4 +312,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -108,6 +108,18 @@ Usage:
{{ include "common.affinities.pods" (dict "type" .type "customLabels" $customLabels "context" .context )}}
{{- end -}}
{{- define "shuffle.worker.hostname" -}}
{{- if .Values.worker.enableHelmDeployment -}}
http://{{ include "shuffle.worker.name" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{- else -}}
http://shuffle-workers.{{ .Release.Namespace }}.svc.cluster.local
{{- end -}}
{{- end -}}
{{- define "shuffle.worker.baseUrl" -}}
{{ include "shuffle.worker.hostname" . }}:{{ .Values.worker.containerPorts.http }}
{{- end -}}
{{/*
Return the environment variables of shuffle-worker in the format
KEY: VALUE
@@ -118,12 +130,7 @@ KUBERNETES_NAMESPACE: "{{ .Release.Namespace }}"
SHUFFLE_SWARM_CONFIG: "run" # Shuffle Worker requires this to be set even when using K8s instead of swarm
BASE_URL: {{ include "shuffle.backend.baseUrl" . | quote }}
SHUFFLE_APP_EXPOSED_PORT: {{ .Values.app.exposedContainerPort | quote }}
{{- if .Values.worker.enableHelmDeployment }}
WORKER_HOSTNAME: "{{ include "shuffle.worker.name" . }}.{{ .Release.Namespace }}.svc.cluster.local"
{{- else }}
WORKER_HOSTNAME: "shuffle-workers.{{ .Release.Namespace }}.svc.cluster.local"
{{- end }}
WORKER_HOSTNAME: {{ include "shuffle.worker.hostname" . }}
{{- if .Values.worker.manageAppDeployments }}
# Shuffle app images
@@ -164,4 +171,4 @@ SHUFFLE_APP_EPHEMERAL_STORAGE_LIMIT: {{ (index $appResources.limits "ephemeral-s
# Include shuffle app environment variables. Worker passes them down to apps, when creating their deployment.
{{ include "shuffle.appInstance.env" . }}
{{- end }}
{{- end -}}
{{- end -}}