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

fix(controller): Fix pod spec jumbling. Fixes #5897 #5899

Merged
merged 2 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,8 @@ spec:
- name: main
container:
image: argoproj/argosay:v2
args:
- echo
- ":) Hello Argo!"
podSpecPatch: '{"terminationGracePeriodSeconds":5, "containers":[{"name":"main", "resources":{"limits":{"cpu": "100m"}}}]}'
# ordering of the containers in the next line is intentionally reversed
podSpecPatch: '{"terminationGracePeriodSeconds":5, "containers":[{"name":"main", "resources":{"limits":{"cpu": "100m"}}}, {"name":"wait", "resources":{"limits":{"cpu": "101m"}}}]}'
`).
When().
SubmitWorkflow().
Expand All @@ -684,6 +682,8 @@ spec:
for _, c := range p.Spec.Containers {
if c.Name == "main" {
assert.Equal(t, c.Resources.Limits.Cpu().String(), "100m")
} else if c.Name == "wait" {
assert.Equal(t, c.Resources.Limits.Cpu().String(), "101m")
}
}
})
Expand Down
1 change: 1 addition & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
if err != nil {
return nil, errors.Wrap(err, "", "Error occurred during strategic merge patch")
}
pod.Spec = apiv1.PodSpec{} // zero out the pod spec so we cannot get conflicts
err = json.Unmarshal(modJson, &pod.Spec)
if err != nil {
return nil, errors.Wrap(err, "", "Error in Unmarshalling after merge the patch")
Expand Down