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 incorrect main container customization precedence and isResourcesSpecified check #4681

Merged
merged 9 commits into from Dec 11, 2020
Merged

fix(controller): Fix incorrect main container customization precedence and isResourcesSpecified check #4681

merged 9 commits into from Dec 11, 2020

Conversation

terrytangyuan
Copy link
Member

@terrytangyuan terrytangyuan commented Dec 9, 2020

This is a follow-up PR of #4656. Changes include:

  • Previously the logic does not handle this precedence logic correctly. Additional tests are added.
  • I found that isResourcesSpecified() always returns True even when resources is apiv1.ResourceRequirements{Limits: apiv1.ResourceList{}}. This is because this case the defaults are "0"s. The current code checks whether the resources are nil which is always False since "k8s.io/apimachinery/pkg/api/resource".Quantity cannot be converted to nil. Additional tests are added.

Signed-off-by: terrytangyuan terrytangyuan@gmail.com

Checklist:

…e and isResourcesSpecified check

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
@terrytangyuan
Copy link
Member Author

/cc @alexec

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
@@ -607,7 +609,7 @@ func (woc *wfOperationCtx) newExecContainer(name string, tmpl *wfv1.Template) *a
}

func isResourcesSpecified(ctr *apiv1.Container) bool {
return ctr != nil && (ctr.Resources.Limits.Cpu() != nil || ctr.Resources.Limits.Memory() != nil)
return ctr != nil && len(ctr.Resources.Limits) != 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reasoning I missed from the current logic? Please help double check this change here. At least the results from the new test cases look fine and expected to me.

@alexec alexec merged commit 55019c6 into argoproj:master Dec 11, 2020
@terrytangyuan terrytangyuan deleted the fix-main-container-config branch December 11, 2020 20:47
This was referenced Dec 15, 2020
simster7 pushed a commit that referenced this pull request Dec 17, 2020
…e and isResourcesSpecified check (#4681)

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants