From de548b4f6d719b5adb637e4de0807b12e17d61be Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Tue, 19 Nov 2024 18:23:38 +0600 Subject: [PATCH] Count node shift of pod as failure Signed-off-by: souravbiswassanto --- pkg/controllers/apps/sidekick_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/apps/sidekick_controller.go b/pkg/controllers/apps/sidekick_controller.go index d42c965..5428889 100644 --- a/pkg/controllers/apps/sidekick_controller.go +++ b/pkg/controllers/apps/sidekick_controller.go @@ -145,11 +145,13 @@ func (r *SidekickReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c if expectedHash != actualHash || leader.Name != pod.Annotations[keyLeader] || leader.Spec.NodeName != pod.Spec.NodeName || (pod.Status.Phase == corev1.PodFailed && sidekick.Spec.RestartPolicy == corev1.RestartPolicyNever) { + if leader.Spec.NodeName != pod.Spec.NodeName && pod.Spec.NodeName != "" { + sidekick.Status.FailureCount[string(pod.GetUID())] = true + } err := r.deletePod(ctx, &pod) if err != nil { return ctrl.Result{}, err } - sidekick.Status.Leader.Name = "" sidekick.Status.Pod = "" sidekick.Status.ObservedGeneration = sidekick.GetGeneration()