Skip to content

Commit 2ab8e5a

Browse files
committed
Skip draining failed DaemonSet pods to prevent recreation loops
In scenarios where nodes experience DiskPressure, DaemonSet pods may be evicted and enter Failed state. When deleting Machines, cluster-api attempts to delete these failed pods, but this triggers DaemonSet to create new pods which can then be evicted again due to persistent DiskPressure, creating an infinite loop. Signed-off-by: liuxu <[email protected]>
1 parent 31ea0af commit 2ab8e5a

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

internal/controllers/machine/drain/filters.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ func (d *Helper) daemonSetFilter(ctx context.Context, pod *corev1.Pod) PodDelete
212212
if controllerRef == nil || controllerRef.Kind != appsv1.SchemeGroupVersion.WithKind("DaemonSet").Kind {
213213
return MakePodDeleteStatusOkay()
214214
}
215-
// Any finished pod can be removed.
216-
if pod.Status.Phase == corev1.PodSucceeded || pod.Status.Phase == corev1.PodFailed {
217-
return MakePodDeleteStatusOkay()
218-
}
219215

220216
if err := d.RemoteClient.Get(ctx, client.ObjectKey{Namespace: pod.Namespace, Name: controllerRef.Name}, &appsv1.DaemonSet{}); err != nil {
221217
// remove orphaned pods with a warning

0 commit comments

Comments
 (0)