mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
EvenPodsSpread: minor enhancement on printing out priority score
This commit is contained in:
parent
821446ed70
commit
3638fd5353
@ -177,6 +177,15 @@ func CalculateEvenPodsSpreadPriority(pod *v1.Pod, nodeNameToInfo map[string]*sch
|
|||||||
for i := range nodes {
|
for i := range nodes {
|
||||||
node := nodes[i]
|
node := nodes[i]
|
||||||
result[i].Host = node.Name
|
result[i].Host = node.Name
|
||||||
|
|
||||||
|
// debugging purpose: print the value for each node
|
||||||
|
// score must be pointer here, otherwise it's always 0
|
||||||
|
if klog.V(10) {
|
||||||
|
defer func(score *int, nodeName string) {
|
||||||
|
klog.Infof("%v -> %v: EvenPodsSpreadPriority, Score: (%d)", pod.Name, nodeName, *score)
|
||||||
|
}(&result[i].Score, node.Name)
|
||||||
|
}
|
||||||
|
|
||||||
if t.counts[node.Name] == nil {
|
if t.counts[node.Name] == nil {
|
||||||
result[i].Score = 0
|
result[i].Score = 0
|
||||||
continue
|
continue
|
||||||
@ -189,9 +198,6 @@ func CalculateEvenPodsSpreadPriority(pod *v1.Pod, nodeNameToInfo map[string]*sch
|
|||||||
// need to reverse b/c the more matching pods it has, the less qualified it is
|
// need to reverse b/c the more matching pods it has, the less qualified it is
|
||||||
// result[i].Score = schedulerapi.MaxPriority - int(fScore)
|
// result[i].Score = schedulerapi.MaxPriority - int(fScore)
|
||||||
result[i].Score = int(fScore)
|
result[i].Score = int(fScore)
|
||||||
if klog.V(10) {
|
|
||||||
klog.Infof("%v -> %v: EvenPodsSpreadPriority, Score: (%d)", pod.Name, node.Name, int(fScore))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user