From ba7d92092bef7ee01852e4e6ed5b6763e65e10ef Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 08:17:56 +1100 Subject: [PATCH] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- workflow/controller/workflowpod.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index c612b12f0cca..47130313a12d 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -301,6 +301,26 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin simplifiedTmpl.Inputs = wfv1.Inputs{ Artifacts: simplifiedTmpl.Inputs.Artifacts, } + + // simplify template by clearing useless volumemounts related to user configmaps ie somecode.py + if simplifiedTmpl.Container != nil && simplifiedTmpl.Container.VolumeMounts != nil { + var filteredVolumeMounts []v1.VolumeMount + for _, mnt := range simplifiedTmpl.Container.VolumeMounts { + isConfigMapVolume := false + for _, vol := range pod.Spec.Volumes { + if vol.Name == mnt.Name && vol.ConfigMap != nil && vol.Name != "argo-env-config" { + isConfigMapVolume = true + break + } + } + if isConfigMapVolume { + continue + } + filteredVolumeMounts = append(filteredVolumeMounts, mnt) + } + simplifiedTmpl.Container.VolumeMounts = filteredVolumeMounts + } + envVarTemplateValue := wfv1.MustMarshallJSON(simplifiedTmpl) // Add standard environment variables, making pod spec larger