From fb07662d7a869bf007ba5ea3e9e034b5c2a800c4 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Fri, 5 Dec 2025 16:00:13 +0100 Subject: [PATCH] set env variables on helm-deployed apps so that they work as expected Signed-off-by: Pascal Sthamer --- .../templates/shuffle-app/shuffle-apps.yaml | 12 ++++++++++- .../templates/shuffle-worker/_helpers.tpl | 21 ++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/functions/kubernetes/charts/shuffle/templates/shuffle-app/shuffle-apps.yaml b/functions/kubernetes/charts/shuffle/templates/shuffle-app/shuffle-apps.yaml index 30f06e87..e15ae74b 100644 --- a/functions/kubernetes/charts/shuffle/templates/shuffle-app/shuffle-apps.yaml +++ b/functions/kubernetes/charts/shuffle/templates/shuffle-app/shuffle-apps.yaml @@ -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 }} \ No newline at end of file +{{- end }} diff --git a/functions/kubernetes/charts/shuffle/templates/shuffle-worker/_helpers.tpl b/functions/kubernetes/charts/shuffle/templates/shuffle-worker/_helpers.tpl index 4caf4f57..692fd6f2 100644 --- a/functions/kubernetes/charts/shuffle/templates/shuffle-worker/_helpers.tpl +++ b/functions/kubernetes/charts/shuffle/templates/shuffle-worker/_helpers.tpl @@ -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 -}} \ No newline at end of file +{{- end -}}