mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
fixup: address comments
This commit is contained in:
parent
b99fb9187b
commit
39e459ae9a
@ -64,7 +64,6 @@ go_test(
|
||||
"//pkg/scheduler/api:go_default_library",
|
||||
"//pkg/scheduler/nodeinfo:go_default_library",
|
||||
"//pkg/scheduler/testing:go_default_library",
|
||||
"//pkg/scheduler/util:go_default_library",
|
||||
"//pkg/volume/util:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
|
@ -1767,11 +1767,9 @@ func EvenPodsSpreadPredicate(pod *v1.Pod, meta PredicateMetadata, nodeInfo *sche
|
||||
// 'existing matching num' + 'if self-match (1 or 0)' - 'global min matching num' <= 'maxSkew'
|
||||
matchNum := len(topologyPairsPodSpreadMap.topologyPairToPods[pair])
|
||||
|
||||
// TODO(Huang-Wei): remove this after thorough testing
|
||||
// fmt.Printf("node '%s' => spreadConstraint[%s]: matchNum(%d) + selfMatchNum(%d) - minMatchNum(%d) ?<= maxSkew(%d)\n", node.Name, tpKey, matchNum, selfMatchNum, minMatchNum, constraint.MaxSkew)
|
||||
|
||||
// TODO(Huang-Wei): check if it can overflow?
|
||||
if int32(matchNum+selfMatchNum)-minMatchNum > constraint.MaxSkew {
|
||||
// cast to int to avoid potential overflow.
|
||||
skew := matchNum + selfMatchNum - int(minMatchNum)
|
||||
if skew > int(constraint.MaxSkew) {
|
||||
klog.V(5).Infof("node '%s' failed spreadConstraint[%s]: matchNum(%d) + selfMatchNum(%d) - minMatchNum(%d) > maxSkew(%d)", node.Name, tpKey, matchNum, selfMatchNum, minMatchNum, constraint.MaxSkew)
|
||||
return false, []PredicateFailureReason{ErrTopologySpreadConstraintsNotMatch}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user