Aggregated used ports at the NodeInfo level.

This commit is contained in:
Klaus Ma
2017-03-04 21:21:06 +08:00
parent cda109d224
commit 1c5292bc2c
3 changed files with 51 additions and 3 deletions

View File

@@ -814,8 +814,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