mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Fix a preemption bug when pods are matched by pdb.Status.DisruptedPods
This commit is contained in:
parent
dc0122ca6a
commit
488621815f
@ -936,15 +936,14 @@ func filterPodsWithPDBViolation(pods []*v1.Pod, pdbs []*policy.PodDisruptionBudg
|
|||||||
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
|
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// 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]--
|
||||||
|
}
|
||||||
// We have found a matching PDB.
|
// We have found a matching PDB.
|
||||||
if pdbsAllowed[i] <= 0 {
|
if pdbsAllowed[i] < 0 {
|
||||||
pdbForPodIsViolated = true
|
pdbForPodIsViolated = true
|
||||||
} else {
|
|
||||||
// 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]--
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user