mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
noderesource: node info already knows which resources are scalar
NodeInfo.Allocatable.ScalarResources already knows which resources are scaler. Also, if the resource name is not present, it's pointless to compute score for a resources the node can not allocate since nodeInfo.Allocatable.ScalarResources[resource] is zero for the case. And both leastRequestedScore and mostRequestedScore returns 0 score for nodes with zero allocatable resource. The balancedResourceScorer deals only with CPU and memory which are not scalable resources.
This commit is contained in:
parent
5c34712a09
commit
11d6576f83
@ -99,7 +99,7 @@ func calculateResourceAllocatableRequest(nodeInfo *framework.NodeInfo, pod *v1.P
|
||||
case v1.ResourceEphemeralStorage:
|
||||
return nodeInfo.Allocatable.EphemeralStorage, (nodeInfo.Requested.EphemeralStorage + podRequest)
|
||||
default:
|
||||
if schedutil.IsScalarResourceName(resource) {
|
||||
if _, exists := nodeInfo.Allocatable.ScalarResources[resource]; exists {
|
||||
return nodeInfo.Allocatable.ScalarResources[resource], (nodeInfo.Requested.ScalarResources[resource] + podRequest)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user