From f17f8acfef6256d7f3f81f1ae772b635d09e7d11 Mon Sep 17 00:00:00 2001 From: Dries De Peuter Date: Thu, 27 Apr 2023 09:56:31 +0200 Subject: [PATCH] fix: Ensure we keep observing --- server/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/main.go b/server/main.go index 6652e79..c1e49e6 100644 --- a/server/main.go +++ b/server/main.go @@ -108,7 +108,10 @@ func main() { RetryPeriod: 5 * time.Second, Callbacks: leaderelection.LeaderCallbacks{ OnStartedLeading: func(ctx context.Context) { - loop(ctx, clientset) + for { + // ensure that we keep observing + loop(ctx, clientset) + } }, OnStoppedLeading: func() { klog.Infof("leader lost: %s", id) @@ -155,7 +158,6 @@ func loop(ctx context.Context, clientset *kubernetes.Clientset) { klog.Error(err) } }) - } }