Avoid copying nodes in priority functions

This commit is contained in:
Wojciech Tyczynski
2016-07-07 13:46:46 +02:00
parent 7219802ac7
commit 6c77c01f24
3 changed files with 15 additions and 8 deletions

View File

@@ -83,7 +83,8 @@ func (s *NodeAffinity) CalculateNodeAffinityPriority(pod *api.Pod, nodeNameToInf
}
result := []schedulerapi.HostPriority{}
for _, node := range nodes.Items {
for i := range nodes.Items {
node := &nodes.Items[i]
fScore := float64(0)
if maxCount > 0 {
fScore = 10 * (float64(counts[node.Name]) / float64(maxCount))