Skip to content

Commit 643f3c0

Browse files
committed
Fix the addon controller on non-OCP clusters
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]>
1 parent a094d75 commit 643f3c0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ func runController(ctx context.Context, controllerContext *controllercmd.Control
182182
wg.Add(1)
183183

184184
go func() {
185+
defer wg.Done()
186+
185187
err := dynamicWatcher.Start(ctx)
186188
if err != nil {
187189
klog.Error(
188190
err, "Unable to start the dynamic watcher for the compliance events database secret reconciler",
189191
)
190192
os.Exit(1)
191193
}
192-
193-
wg.Done()
194194
}()
195195

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

235235
go func() {
236+
defer wg.Done()
237+
236238
err = mgr.Start(ctx)
237239
if err != nil {
238240
klog.Error(err, "problem starting manager")
239241
os.Exit(1)
240242
}
241243

242-
wg.Done()
244+
// mgr.Start is not blocking so wait on the context to finish
245+
<-ctx.Done()
243246
}()
244247

245248
wg.Wait()

0 commit comments

Comments
 (0)