Save pod priority to avoid repeated calculation

This commit is contained in:
Jun Gong 2019-04-11 11:09:47 +08:00
parent b8b5b1c254
commit 49832cf887

View File

@ -1160,8 +1160,9 @@ func podEligibleToPreemptOthers(pod *v1.Pod, nodeNameToInfo map[string]*schedule
nomNodeName := pod.Status.NominatedNodeName
if len(nomNodeName) > 0 {
if nodeInfo, found := nodeNameToInfo[nomNodeName]; found {
podPriority := util.GetPodPriority(pod)
for _, p := range nodeInfo.Pods() {
if p.DeletionTimestamp != nil && util.GetPodPriority(p) < util.GetPodPriority(pod) {
if p.DeletionTimestamp != nil && util.GetPodPriority(p) < podPriority {
// There is a terminating pod on the nominated node.
return false
}