fix: status.go - ignore terminating pods as leaders

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets 2023-12-04 22:01:51 +01:00
parent c4766f7660
commit a0344d64b3

View file

@ -270,7 +270,18 @@ func (s *statusSync) isRunningMultiplePods() bool {
return false return false
} }
return len(pods.Items) > 1 runningPods := make([]apiv1.Pod, 0)
for i := range pods.Items {
pod := pods.Items[i]
if pod.GetDeletionTimestamp() != nil {
klog.InfoS("POD is terminating", "pod", klog.KObj(&pod), "node", pod.Spec.NodeName)
continue
}
runningPods = append(runningPods, pod)
}
return len(runningPods) > 1
} }
// standardizeLoadBalancerIngresses sorts the list of loadbalancer by // standardizeLoadBalancerIngresses sorts the list of loadbalancer by