From 41a0adb755bce7dc2a9ac23c3f03471b0f8d4263 Mon Sep 17 00:00:00 2001 From: Gabor Retvari Date: Wed, 4 Sep 2024 22:51:41 +0200 Subject: [PATCH] fix: Exit when the operator fails to start up We forgot to add an exit call to the `operator. Start()` call's error path. This leads to strange bugs then the operator cannot access the API server due to a transient problem, the operator fails to register itself as a Gateway API controller so it will not get the watch events it should handle, but instead of exiting it's just sitting there doing nothing. This change makes sure the operator restarts when the API server is unreachable. --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index b5589b7..ddb1b75 100644 --- a/main.go +++ b/main.go @@ -231,6 +231,7 @@ func main() { setupLog.Info("starting operator thread") if err := op.Start(opCtx, mgrCancel); err != nil { setupLog.Error(err, "problem running operator") + os.Exit(1) } setupLog.Info("starting Kubernetes controller manager")