diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index 8f8ff7dceba5..69f631160845 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -686,6 +686,7 @@ func (woc *wfOperationCtx) newExecContainer(name string, tmpl *wfv1.Template) *a Env: woc.createEnvVars(), Resources: woc.controller.Config.GetExecutor().Resources, SecurityContext: woc.controller.Config.GetExecutor().SecurityContext, + Args: woc.controller.Config.GetExecutor().Args, } // lock down resource pods by default if tmpl.GetType() == wfv1.TemplateTypeResource && exec.SecurityContext == nil { diff --git a/workflow/controller/workflowpod_test.go b/workflow/controller/workflowpod_test.go index 869b25453873..06e5077a4718 100644 --- a/workflow/controller/workflowpod_test.go +++ b/workflow/controller/workflowpod_test.go @@ -325,8 +325,8 @@ func TestTmplLevelExecutorServiceAccountName(t *testing.T) { verifyServiceAccountTokenVolumeMount(t, waitCtr, "exec-sa-token", "/var/run/secrets/kubernetes.io/serviceaccount") } -// TestTmplLevelExecutorServiceAccountName verifies the ability to carry forward template level AutomountServiceAccountToken to Podspec. -func TestTmplLevelExecutorSecurityContext(t *testing.T) { +// TestCtrlLevelExecutorSecurityContext verifies the ability to carry forward Controller level SecurityContext to Podspec. +func TestCtrlLevelExecutorSecurityContext(t *testing.T) { var user int64 = 1000 ctx := context.Background() woc := newWoc() @@ -1489,6 +1489,26 @@ func TestMainContainerCustomization(t *testing.T) { }) } +func TestExecutorContainerCustomization(t *testing.T) { + woc := newWoc() + woc.controller.Config.Executor = &apiv1.Container{ + Args: []string{"foo"}, + Resources: apiv1.ResourceRequirements{ + Limits: apiv1.ResourceList{ + apiv1.ResourceCPU: resource.MustParse("0.900"), + apiv1.ResourceMemory: resource.MustParse("512Mi"), + }, + }, + } + + pod, err := woc.createWorkflowPod(context.Background(), "", nil, &wfv1.Template{}, &createWorkflowPodOpts{}) + assert.NoError(t, err) + waitCtr := pod.Spec.Containers[0] + assert.Equal(t, []string{"foo"}, waitCtr.Args) + assert.Equal(t, "0.900", waitCtr.Resources.Limits.Cpu().AsDec().String()) + assert.Equal(t, "536870912", waitCtr.Resources.Limits.Memory().AsDec().String()) +} + var helloWindowsWf = ` apiVersion: argoproj.io/v1alpha1 kind: Workflow