Skip to content

Commit 337e12a

Browse files
author
Marcelo Guerrero
committed
WIP Skip pods marked for deletion
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 <marguerr@redhat.com>
1 parent c5e45aa commit 337e12a

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)