Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: don't add configmap volumemounts in ARGO_TEMPLATE. Partial fix for #13089 #13792

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,43 @@ 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 []apiv1.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
}
if simplifiedTmpl.Script != nil && simplifiedTmpl.Script.VolumeMounts != nil {
var filteredVolumeMountsScript []apiv1.VolumeMount
for _, mnt := range simplifiedTmpl.Script.VolumeMounts {
isConfigMapVolumeScript := false
for _, vol := range pod.Spec.Volumes {
if vol.Name == mnt.Name && vol.ConfigMap != nil && vol.Name != "argo-env-config" {
isConfigMapVolumeScript = true
break
}
}
if isConfigMapVolumeScript {
continue
}
filteredVolumeMountsScript = append(filteredVolumeMountsScript, mnt)
}
simplifiedTmpl.Script.VolumeMounts = filteredVolumeMountsScript
}

envVarTemplateValue := wfv1.MustMarshallJSON(simplifiedTmpl)

// Add standard environment variables, making pod spec larger
Expand Down
Loading