Computing DisruptedPods of PDB in scheduling preemption

This commit is contained in:
Alex Wang
2020-06-16 10:24:55 +08:00
parent b93e9d9395
commit 02e4060b1b
2 changed files with 39 additions and 2 deletions

View File

@@ -916,9 +916,12 @@ func filterPodsWithPDBViolation(pods []*v1.Pod, pdbs []*policy.PodDisruptionBudg
// We have found a matching PDB.
if pdbsAllowed[i] <= 0 {
pdbForPodIsViolated = true
break
} else {
pdbsAllowed[i]--
// Only decrement the matched pdb when it's not in its <DisruptedPods>;
// otherwise we may over-decrement the budget number.
if _, exist := pdb.Status.DisruptedPods[pod.Name]; !exist {
pdbsAllowed[i]--
}
}
}
}