Skip to content

Commit 8c38117

Browse files
authored
Merge pull request #485 from mlguerrero12/fixstateless
Skip pods marked for deletion
2 parents c5e45aa + 337e12a commit 8c38117

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/reconciler/wrappedPod.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
4646
if _, isWhereaboutsPod := whereaboutsPodNames[podRef]; !isWhereaboutsPod {
4747
continue
4848
}
49+
50+
if isPodMarkedForDeletion(pod.Status.Conditions) {
51+
logging.Debugf("Pod %s is marked for deletion; skipping", podRef)
52+
continue
53+
}
54+
4955
wrappedPod := wrapPod(pod)
5056
if wrappedPod != nil {
5157
podMap[podRef] = *wrappedPod
@@ -54,6 +60,15 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
5460
return podMap
5561
}
5662

63+
func isPodMarkedForDeletion(conditions []v1.PodCondition) bool {
64+
for _, c := range conditions {
65+
if c.Type == v1.DisruptionTarget && c.Status == v1.ConditionTrue && c.Reason == "DeletionByTaintManager" {
66+
return true
67+
}
68+
}
69+
return false
70+
}
71+
5772
func getFlatIPSet(pod v1.Pod) (map[string]void, error) {
5873
var empty void
5974
ipSet := map[string]void{}

0 commit comments

Comments
 (0)