Skip to content

Commit 5fafb38

Browse files
committed
config: Shutdown CVO if configuration controller fails to start
An error in the start logic will now result in the immediate shutdown of the CVO, rather than in the CVO catching the failed controller and continuing to work by ignoring the failed start.
1 parent 12099d8 commit 5fafb38

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pkg/cvo/cvo.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,12 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co
459459
return fmt.Errorf("caches never synchronized: %w", runContext.Err())
460460
}
461461

462+
if optr.configuration != nil {
463+
if err := optr.configuration.Start(runContext); err != nil {
464+
return fmt.Errorf("unable to initialize the CVO configuration controller: %v", err)
465+
}
466+
}
467+
462468
// trigger the first cluster version reconcile always
463469
optr.queue.Add(optr.queueKey())
464470

@@ -489,13 +495,9 @@ func (optr *Operator) Run(runContext context.Context, shutdownContext context.Co
489495
resultChannelCount++
490496
go func() {
491497
defer utilruntime.HandleCrash()
492-
if err := optr.configuration.Start(runContext); err != nil {
493-
utilruntime.HandleError(fmt.Errorf("unable to initialize the CVO configuration sync: %v", err))
494-
} else {
495-
wait.UntilWithContext(runContext, func(runContext context.Context) {
496-
optr.worker(runContext, optr.configuration.Queue(), optr.configuration.Sync)
497-
}, time.Second)
498-
}
498+
wait.UntilWithContext(runContext, func(runContext context.Context) {
499+
optr.worker(runContext, optr.configuration.Queue(), optr.configuration.Sync)
500+
}, time.Second)
499501
resultChannel <- asyncResult{name: "cvo configuration"}
500502
}()
501503
} else {

0 commit comments

Comments
 (0)