Merge pull request #42524 from k82cn/used_ports_per_node

Automatic merge from submit-queue (batch tested with PRs 41775, 39678, 42629, 42524, 43028)

Aggregated used ports at the NodeInfo level.

fixes #42523

```release-note
Aggregated used ports at the NodeInfo level for `PodFitsHostPorts` predicate.
```
This commit is contained in:
Kubernetes Submit Queue
2017-04-07 17:44:19 -07:00
committed by GitHub
3 changed files with 51 additions and 3 deletions

View File

@@ -836,8 +836,7 @@ func PodFitsHostPorts(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.No
return true, nil, nil
}
// TODO: Aggregate it at the NodeInfo level.
existingPorts := GetUsedPorts(nodeInfo.Pods()...)
existingPorts := nodeInfo.UsedPorts()
for wport := range wantPorts {
if wport != 0 && existingPorts[wport] {
return false, []algorithm.PredicateFailureReason{ErrPodNotFitsHostPorts}, nil