-
Notifications
You must be signed in to change notification settings - Fork 976
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
skip 'pods' resource when checking if the Resource is empty #3223
Conversation
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.
/LGTM
/LGTM |
@neujie: changing LGTM is restricted to collaborators 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. |
/lgtm |
pkg/scheduler/api/resource_info.go
Outdated
// All pods request one "pods" resource now, no need to check it | ||
var emptyCheckIgnoredScalarResources = sets.NewString(string(v1.ResourcePods)) | ||
|
||
func IsEmptyCheckIgnoredScalarResource(name v1.ResourceName) bool { |
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.
It's better to change a readable function name. For example, IsIgnoredScalarResource
or IsInBlacklist
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.
Done
pkg/scheduler/api/resource_info.go
Outdated
func IsEmptyCheckIgnoredScalarResource(name v1.ResourceName) bool { | ||
return emptyCheckIgnoredScalarResources.Has(string(name)) | ||
} | ||
|
||
// IsEmpty returns false if any kind of resource is not less than min value, otherwise returns true |
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 role has changed, please update the description for this function
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.
Done
Signed-off-by: lili <lili_9309@163.com>
/lgtm |
func (r *Resource) IsEmpty() bool { | ||
if !(r.MilliCPU < minResource && r.Memory < minResource) { | ||
return false | ||
} | ||
|
||
for _, rQuant := range r.ScalarResources { | ||
for rName, rQuant := range r.ScalarResources { | ||
if IsIgnoredScalarResource(rName) { |
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 don't use "ignoredScalarResources.Has" direclty to judge it? Currenty, there will be one more function calling.
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lowang-bh, william-wang 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 |
fix issue: #3227
Design:
Skip 'pods' resource when checking if the Resource is empty.