-
Notifications
You must be signed in to change notification settings - Fork 883
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 pod cannot be allocated with sufficient resource #1851
Conversation
Welcome @aidaizyy! |
/assign @Thor-wl |
d2be3e7
to
eba4681
Compare
attr.deserved = helpers.Min(attr.deserved, attr.capability) | ||
} | ||
|
||
if attr.capability != nil && attr.capability.LessEqual(attr.deserved, api.Zero) { |
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.
What if some dimensions are lack in some queue's capability? For example, capability of q1 = {cpu:10c}, but there must be cpu
and memory
in deserved.
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.
In the previous code, helpers.Min
also make the deserved memory is 0.
if attr.capability != nil && !attr.deserved.LessEqual(attr.capability, api.Infinity) {
attr.deserved = helpers.Min(attr.deserved, attr.capability)
……
In the current semantics, this situation means that the memory deserved is 0 always.
I think this pr didn't make it worse.
But if necessary, I can fix this problem in this pr or another pr soon.
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 get you. In fact, deserved cpu and memory will never be zero for they are necessary dimensions. What I want to express is that lack dimension in capability should be infinity.
eba4681
to
5ff00ee
Compare
@Thor-wl pls review agin. |
7f7c23f
to
2d7eb86
Compare
pkg/scheduler/api/resource_info.go
Outdated
func (r *Resource) MinDimensionResource(rr *Resource) *Resource { | ||
if rr.MilliCPU < r.MilliCPU { | ||
r.MilliCPU = rr.MilliCPU | ||
// @param defaultValue "default value for resource dimension not defined in CPU/Memory/ScalarResources. Its value can only be one of 'Zero' and 'Infinity'" |
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.
defaultValue
is ALWAYS represents the undefined ScalarResources in the previous codes. Please maintain the consistency.
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.
There has never been a default value for the main resource (cpu/memory) when there is no definition in the project, but this is meaningful for the capability. I am more embarrassed how to express, please review whether my latest revision is reasonable.
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.
The better way to achieve that is to set the default value of capacity.cpu
, capacity.memory
in the admission web-hook or the AddQueue
in the event_handler
.
/cc @Thor-wl
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.
Good suggestion! I set math.maxFloat64
for cpu and memory in OnSessionOpen. This modification should be the best with few changes.
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.
Pls fix the DCO @aidaizyy |
64f5449
to
e432985
Compare
e432985
to
8500639
Compare
Signed-off-by: zhangyunyao <aidaizyy@gmail.com>
8500639
to
19a940b
Compare
if rr.MilliCPU < r.MilliCPU { | ||
r.MilliCPU = rr.MilliCPU | ||
} | ||
if rr.Memory < r.Memory { | ||
r.Memory = rr.Memory | ||
} | ||
|
||
if r.ScalarResources == nil { |
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.
no needs for the == nil
comparation.
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.
This is a kind-hearted redundancy. :)
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Thor-wl 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 |
/lgtm |
background: #1850