-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 the default setting of CPU requests on vmipods #6374
Conversation
d8fb3ce
to
121c1d3
Compare
…al to vCPUs Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
121c1d3
to
76fb080
Compare
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
76fb080
to
490711d
Compare
/cc @rmohr |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jean-edouard 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 |
@@ -858,7 +858,7 @@ func (t *templateService) renderLaunchManifest(vmi *v1.VirtualMachineInstance, t | |||
if vcpus != 0 && cpuAllocationRatio > 0 { | |||
val := float64(vcpus) / float64(cpuAllocationRatio) | |||
vcpusStr := fmt.Sprintf("%g", val) | |||
if val < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am just curious here. How can vcpus be 0? (line 858)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's not provided? Not sure, but it's better to check.
@@ -221,7 +221,7 @@ var _ = Describe("VirtualMachineInstance Mutator", func() { | |||
Expect(vmiSpec.Domain.CPU.Model).To(Equal("")) | |||
} | |||
|
|||
Expect(vmiSpec.Domain.Resources.Requests.Cpu().String()).To(Equal("100m")) | |||
Expect(vmiSpec.Domain.Resources.Requests.Cpu().IsZero()).To(BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the default will be calculated and normalized according to the cpu allocation ratio.
/lgtm |
/cherry-pick release-0.44 |
@stu-gott: new pull request created: #6423 In response to this:
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. |
/cherry-pick release-0.41 |
@stu-gott: new pull request created: #6453 In response to this:
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. |
What this PR does / why we need it:
This PR fixes the default setting of CPU requests on the virt-launcher compute container.
The default vmipods CPU request is being calculated during the pod creation and scales with the number of vCPUS according to the
cpu_allocation_ratio
(which defaults to 10) settingThis way, the default CPU request of a vmipod , created for a VMI with 1 vCPU, will be 100m.
This PR adds unit and functional tests to verify the correct behavior.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes # rhbz#2002313