From d3b59b89229329744904b5294cf691f21383c04b Mon Sep 17 00:00:00 2001 From: georgekaz <1391828+georgekaz@users.noreply.github.com> Date: Fri, 5 Nov 2021 16:48:36 +0000 Subject: [PATCH] Exclude terminated pods from the blocking mechanism Terminated pods should be excluded from the blocking a reboot as per https://github.com/weaveworks/kured/issues/227 This adds status filters to the fieldSelector in order to do that. I've not updated tests here but have successfully tested the exact same filter using kubectl --- cmd/kured/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kured/main.go b/cmd/kured/main.go index 528dc76..7d66e52 100644 --- a/cmd/kured/main.go +++ b/cmd/kured/main.go @@ -284,7 +284,7 @@ func (pb PrometheusBlockingChecker) isBlocked() bool { } func (kb KubernetesBlockingChecker) isBlocked() bool { - fieldSelector := fmt.Sprintf("spec.nodeName=%s", kb.nodename) + fieldSelector := fmt.Sprintf("spec.nodeName=%s,status.phase!=Succeeded,status.phase!=Failed,status.phase!=Unknown", kb.nodename) for _, labelSelector := range kb.filter { podList, err := kb.client.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{ LabelSelector: labelSelector,