Skip to content

Commit

Permalink
Fix the addon controller on non-OCP clusters
Browse files Browse the repository at this point in the history
The addon controller would exit prematurely if there wasn't the
ComplianceDBSecretReconciler running to keep an active wait group.

Signed-off-by: mprahl <[email protected]>
  • Loading branch information
mprahl committed Mar 27, 2024
1 parent a094d75 commit 643f3c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ func runController(ctx context.Context, controllerContext *controllercmd.Control
wg.Add(1)

go func() {
defer wg.Done()

err := dynamicWatcher.Start(ctx)
if err != nil {
klog.Error(
err, "Unable to start the dynamic watcher for the compliance events database secret reconciler",
)
os.Exit(1)
}

wg.Done()
}()

klog.Info("Waiting for the dynamic watcher to start")
Expand Down Expand Up @@ -233,13 +233,16 @@ func runController(ctx context.Context, controllerContext *controllercmd.Control
wg.Add(1)

go func() {
defer wg.Done()

err = mgr.Start(ctx)
if err != nil {
klog.Error(err, "problem starting manager")
os.Exit(1)
}

wg.Done()
// mgr.Start is not blocking so wait on the context to finish
<-ctx.Done()
}()

wg.Wait()
Expand Down

0 comments on commit 643f3c0

Please sign in to comment.