Skip to content

Commit

Permalink
fix(controller): Force main container name to be "main" as per v3.0. F…
Browse files Browse the repository at this point in the history
…ixes #6405 (#6408)

Signed-off-by: Alex Collins <alex_collins@intuit.com>
  • Loading branch information
alexec authored Jul 23, 2021
1 parent 2df5f66 commit f2d24b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
wfSpec := woc.execWf.Spec.DeepCopy()

for i, c := range mainCtrs {
if c.Name == "" {
if c.Name == "" || tmpl.GetType() != wfv1.TemplateTypeContainerSet {
c.Name = common.MainContainerName
}
// Allow customization of main container resources.
Expand Down
7 changes: 7 additions & 0 deletions workflow/controller/workflowpod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,13 @@ func Test_createWorkflowPod_rateLimited(t *testing.T) {
}
}

func Test_createWorkflowPod_containerName(t *testing.T) {
woc := newWoc()
pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Name: "invalid"}}, &wfv1.Template{}, &createWorkflowPodOpts{})
assert.NoError(t, err)
assert.Equal(t, common.MainContainerName, pod.Spec.Containers[1].Name)
}

func Test_createWorkflowPod_emissary(t *testing.T) {
t.Run("NoCommand", func(t *testing.T) {
woc := newWoc()
Expand Down

0 comments on commit f2d24b1

Please sign in to comment.