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: Include restartable init containers in Pod utilization calc #6225

Merged

Conversation

azylinski
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fix pod resources utilization calculation - Include restartable init containers

Similar logic is already in k/k: https://github.com/kubernetes/kubernetes/blob/8453eb0c24ea61794157b451e4442ea570abce45/pkg/controller/podautoscaler/replica_calculator.go#L424

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/cluster-autoscaler labels Oct 25, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 25, 2023
@x13n
Copy link
Member

x13n commented Oct 26, 2023

Can you clarify what problem this is solving?

@towca
Copy link
Collaborator

towca commented Nov 10, 2023

/assign @towca

@towca
Copy link
Collaborator

towca commented Nov 16, 2023

Can you clarify what problem this is solving?

It's bringing CA util calculations in line with the scheduler. Without it, in some weird cases CA could be underestimating how much of a node's resources a pod is taking. E.g. a pod with containers requesting only 1 CPU, but with an initContainer requesting 7 CPU scheduled on an 8-core Node. CA could scale the node down because it'd calculate the utilization as 1/8, when actually the pod is taking 7/8 of the Node.

@azylinski azylinski force-pushed the fix-calc-pod-cpu-utilization branch from 3c64cc6 to fc4f607 Compare November 20, 2023 09:33
@azylinski azylinski force-pushed the fix-calc-pod-cpu-utilization branch from fc4f607 to 2821f4e Compare November 23, 2023 09:10
@azylinski azylinski force-pushed the fix-calc-pod-cpu-utilization branch from 2821f4e to 54909eb Compare November 23, 2023 09:24
@towca
Copy link
Collaborator

towca commented Nov 23, 2023

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: azylinski, towca

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

The pull request process is described here

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 Nov 23, 2023
@k8s-ci-robot k8s-ci-robot merged commit 03bf1e6 into kubernetes:master Nov 23, 2023
6 checks passed
@azylinski azylinski deleted the fix-calc-pod-cpu-utilization branch November 28, 2023 12:49
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/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants