Skip to content

Commit 5092956

Browse files
committed
Reconciler: skip failed or succeeded Pods in live Pod list
1 parent ca99990 commit 5092956

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/reconciler/wrappedPod.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
4747
continue
4848
}
4949

50-
if isPodMarkedForDeletion(pod.Status.Conditions) {
50+
if isPodMarkedForDeletion(&pod) {
5151
logging.Debugf("Pod %s is marked for deletion; skipping", podRef)
5252
continue
5353
}
@@ -60,13 +60,15 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
6060
return podMap
6161
}
6262

63-
func isPodMarkedForDeletion(conditions []v1.PodCondition) bool {
64-
for _, c := range conditions {
63+
func isPodMarkedForDeletion(pod *v1.Pod) bool {
64+
for _, c := range pod.Status.Conditions {
6565
if c.Type == v1.DisruptionTarget && c.Status == v1.ConditionTrue && c.Reason == "DeletionByTaintManager" {
6666
return true
6767
}
6868
}
69-
return false
69+
70+
// If a Pod ran to completion, like a Job, consider it dead
71+
return pod.Status.Phase == v1.PodFailed || pod.Status.Phase == v1.PodSucceeded
7072
}
7173

7274
func getFlatIPSet(pod v1.Pod) (map[string]void, error) {

0 commit comments

Comments
 (0)