diff --git a/pkg/autodetect/main.go b/pkg/autodetect/main.go index de183d4d9..1afd4f583 100644 --- a/pkg/autodetect/main.go +++ b/pkg/autodetect/main.go @@ -63,18 +63,12 @@ func WithClients(cl client.Client, dcl discovery.DiscoveryInterface, clr client. func (b *Background) Start() { // periodically attempts to auto detect all the capabilities for this operator b.ticker = time.NewTicker(5 * time.Second) - - done := make(chan bool) - go func() { - b.autoDetectCapabilities() - done <- true - }() + b.autoDetectCapabilities() + log.Trace("finished the first auto-detection") go func() { for { select { - case <-done: - log.Trace("finished the first auto-detection") case <-b.ticker.C: b.autoDetectCapabilities() } diff --git a/pkg/cmd/start/bootstrap.go b/pkg/cmd/start/bootstrap.go index 2dde6d833..8f7b7bce6 100644 --- a/pkg/cmd/start/bootstrap.go +++ b/pkg/cmd/start/bootstrap.go @@ -105,6 +105,12 @@ func bootstrap(ctx context.Context) manager.Manager { mgr := createManager(ctx, cfg) + if d, err := autodetect.New(mgr); err != nil { + log.WithError(err).Warn("failed to start the background process to auto-detect the operator capabilities") + } else { + d.Start() + } + detectNamespacePermissions(ctx, mgr) performUpgrades(ctx, mgr) setupControllers(ctx, mgr) @@ -113,11 +119,6 @@ func bootstrap(ctx context.Context) manager.Manager { if err != nil { log.WithError(err).Error("failed to initialize metrics") } - if d, err := autodetect.New(mgr); err != nil { - log.WithError(err).Warn("failed to start the background process to auto-detect the operator capabilities") - } else { - d.Start() - } return mgr }