Skip to content

Commit

Permalink
Merge pull request #485 from mlguerrero12/fixstateless
Browse files Browse the repository at this point in the history
Skip pods marked for deletion
  • Loading branch information
mlguerrero12 authored Jul 17, 2024
2 parents c5e45aa + 337e12a commit 8c38117
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/reconciler/wrappedPod.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
if _, isWhereaboutsPod := whereaboutsPodNames[podRef]; !isWhereaboutsPod {
continue
}

if isPodMarkedForDeletion(pod.Status.Conditions) {
logging.Debugf("Pod %s is marked for deletion; skipping", podRef)
continue
}

wrappedPod := wrapPod(pod)
if wrappedPod != nil {
podMap[podRef] = *wrappedPod
Expand All @@ -54,6 +60,15 @@ func indexPods(livePodList []v1.Pod, whereaboutsPodNames map[string]void) map[st
return podMap
}

func isPodMarkedForDeletion(conditions []v1.PodCondition) bool {
for _, c := range conditions {
if c.Type == v1.DisruptionTarget && c.Status == v1.ConditionTrue && c.Reason == "DeletionByTaintManager" {
return true
}
}
return false
}

func getFlatIPSet(pod v1.Pod) (map[string]void, error) {
var empty void
ipSet := map[string]void{}
Expand Down

0 comments on commit 8c38117

Please sign in to comment.