Skip to content

Kubelet enabling to support pod-overhead#79247

Merged
k8s-ci-robot merged 4 commits intokubernetes:masterfrom
egernst:kubelet-PodOverhead
Aug 20, 2019
Merged

Kubelet enabling to support pod-overhead#79247
k8s-ci-robot merged 4 commits intokubernetes:masterfrom
egernst:kubelet-PodOverhead

Conversation

@egernst
Copy link
Copy Markdown
Contributor

@egernst egernst commented Jun 21, 2019

Pod and burstable QoS cgroups should take overhead of running a sandbox
into account if the PodOverhead feature is enabled. Update helper
functions which are utilized by Kubelet for sizing the pod and burstable QoS
cgroups as well as for eviction and preemption handling.

While enabling PodOverhead support, refactored a couple of functions to remove duplicated logic and improve test coverage (ie, have eviction handling use the resources package).

What type of PR is this?

/kind feature

What this PR does / why we need it:
Pod and burstable QoS cgroups should take overhead of running a sandbox
into account if the PodOverhead feature is enabled. Similarly, pod overhead should be considered within the eviction handling in Kubernetes.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Introduce support for applying pod overhead to pod cgroups, if the PodOverhead feature is enabled.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 21, 2019
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Jun 21, 2019

/cc @tallclair @dashpole

The changes are pretty basic, but I was having issues getting a basic unit test working for PodRequestsAndLimits (there wasn't a test for this function before). AFAICT, when you add two resourceLists, the string associated with each quantity is dropped. Is this just an optimization (creating string is a costly operation?)?

ie:

--- FAIL: TestPodRequestsAndLimits (0.00s)
    helpers_test.go:264: test case failure: [2]
        expected:       map[cpu:{{6 0} {<nil>} 6 DecimalSI} memory:{{15 0} {<nil>} 15 DecimalSI}]
        got             map[cpu:{{6 0} {<nil>}  DecimalSI} memory:{{15 0} {<nil>}  DecimalSI}]

I think this is why the Deep.Equal is failing. Is this the expected behavior? Or, any suggestions?

@egernst egernst force-pushed the kubelet-PodOverhead branch from 6e67a56 to 68cfa0b Compare June 21, 2019 01:12
@egernst egernst force-pushed the kubelet-PodOverhead branch from 68cfa0b to 6837f7b Compare June 21, 2019 17:03
@dashpole
Copy link
Copy Markdown
Contributor

Can we use quantity's Equal method to test equality of quantities instead of DeepEqual?

@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Jun 21, 2019

@dashpole - yes, but that'll require looping through each resource in the list, verifying each entry exists, and that for each quantity, quantity.Equal(expected). A bit painful; I'd at least like to understand if its expected behavior or not. Perhaps there should be a "ResourceList" Equal function?

@egernst egernst force-pushed the kubelet-PodOverhead branch 2 times, most recently from 2163ce4 to 751e2d9 Compare August 2, 2019 17:31
@egernst egernst changed the title pod-overhead: add pod overhead to resouce requests pod-overhead: utilize pod overhead for cgroup sizing in kubelet Aug 2, 2019
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Aug 2, 2019

Updated the test per @dashpole's recommendation, and improved limits handling

@egernst egernst force-pushed the kubelet-PodOverhead branch from 751e2d9 to 87d1f3f Compare August 2, 2019 17:36
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Aug 2, 2019

/cc @mcastelino @jcvenegas

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@egernst: GitHub didn't allow me to request PR reviews from the following users: mcastelino, jcvenegas.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

/cc @mcastelino @jcvenegas

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@egernst egernst changed the title pod-overhead: utilize pod overhead for cgroup sizing in kubelet Kubelet enabling to support pod-overhead Aug 2, 2019
@egernst egernst force-pushed the kubelet-PodOverhead branch from 87d1f3f to 08f189a Compare August 2, 2019 22:14
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 2, 2019
Copy link
Copy Markdown
Contributor Author

@egernst egernst left a comment

Choose a reason for hiding this comment

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

Updated based on feedback - PTAL @tallclair @dashpole

Eric Ernst added 3 commits August 13, 2019 16:23
Update GetResoureqRequest function to utilize a new helper,
GetResourceRequestQuantity. This logic was duplicated in a couple of
areas in the K/K codebase, so consolidating for better test coverage.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
Utilize resource helpers' GetResourceRequestQuantity instead of
duplicating the logic here.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
No test content changes - just improvements for readability

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
Copy link
Copy Markdown
Member

@tallclair tallclair left a comment

Choose a reason for hiding this comment

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

Mostly nits, sorry to complain about the newlines.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks, so much more readable this way.

@egernst egernst force-pushed the kubelet-PodOverhead branch from 0b515bc to 05b9ff4 Compare August 15, 2019 22:55
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Aug 15, 2019

Thanks @tallclair - will keep that in mind for next PR. Addressed feedback, including utilizing .Copy() instead of assigning potential cached value.

@tallclair
Copy link
Copy Markdown
Member

Thanks!

/lgtm
/approve

Need to fix up ssome of those CI failures. rerun hack/update-bazel.sh, not sure if there are other issues.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2019
@egernst egernst force-pushed the kubelet-PodOverhead branch from 05b9ff4 to b813515 Compare August 19, 2019 18:34
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2019
@tallclair
Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2019
@tallclair
Copy link
Copy Markdown
Member

/assign @thockin
For /pkg/api approval.

Copy link
Copy Markdown
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks!

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: egernst, tallclair, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2019
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Aug 20, 2019

/test pull-kubernetes-e2e-gce

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: use DeepCopy (#81627)

Suggested change
requestQuantity = *rQuantity.Copy()
requestQuantity = rQuantity.DeepCopy()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@tallclair
Copy link
Copy Markdown
Member

Hmm, the test failures are somewhat suspicious since it's the density & loader tests failing, which would be affected by PodOverhead. Except that overhead on those should be zero, and I think the feature gate is disabled, so probably a flake. Worth taking a look at though.

@egernst egernst force-pushed the kubelet-PodOverhead branch from b813515 to 80ee072 Compare August 20, 2019 00:33
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 20, 2019
Pod and burstable QoS cgroups should take overhead of running a sandbox
into account if the PodOverhead feature is enabled. These helper
functions are utilized by Kubelet for sizing the pod and burstable QoS
cgroups.

Pod overhead is added to resource requests, regardless of the initial
request values. A particular resource pod overhead is only added to a
resource limit if a non-zero limit already existed.

This commit updates eviction handling to also take Pod Overhead into
account (if the feature is enabled).

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
@egernst
Copy link
Copy Markdown
Contributor Author

egernst commented Aug 20, 2019

Hmm, the test failures are somewhat suspicious since it's the density & loader tests failing, which would be affected by PodOverhead. Except that overhead on those should be zero, and I think the feature gate is disabled, so probably a flake. Worth taking a look at though.

Thanks. It is at the very least a reminder of e2e tests which should be added for PodOverhead.

@tallclair
Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 20, 2019
@k8s-ci-robot k8s-ci-robot merged commit 8cf05f5 into kubernetes:master Aug 20, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 20, 2019
totalResources += rQuantity.Value()
}
if rQuantity, ok := container.Resources.Requests[resourceName]; ok {
requestQuantity.Add(rQuantity)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should rQuantity.MilliValue() be used if resourceName is v1.ResourceCPU ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants