Skip to content

Commit

Permalink
WIP Skip pods marked for deletion
Browse files Browse the repository at this point in the history
In cases where the amount of ips is limited, pods affected by
a node shutdown remain in Terminating state and do not release
their allocations. Deployments are not able to create pods in
healthy nodes due to the lack of ips. These changes force the
ip reconciler to skip pods marked as deletion by a Taint Manager.
The toleration node.kubernetes.io/unreachable is expected to trigger
this. However, it is safe if other tolerations with NoExecute also
trigger the cleaning up.

Signed-off-by: Marcelo Guerrero <[email protected]>
  • Loading branch information
mlguerrero12 committed Jul 9, 2024
1 parent c5e45aa commit 337e12a
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 337e12a

Please sign in to comment.