@@ -57,8 +57,6 @@ import (
5757 "github.com/DataDog/datadog-operator/pkg/version"
5858
5959 _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
60- // nolint:gci
61- // +kubebuilder:scaffold:imports
6260)
6361
6462const (
@@ -321,7 +319,7 @@ func run(opts *options) error {
321319 // If RBAC restricts list and watch permissions, the informer will log errors and may cause crash loops.
322320 // Reader interface as returned from mgr.GetAPIReader() reads directly from API server bypassing cache and informer initialization.
323321 credsManager := config .NewCredentialManagerWithDecryptor (mgr .GetAPIReader (), secrets .NewSecretBackend ())
324- creds , err : = credsManager .GetCredentials ()
322+ _ , err = credsManager .GetCredentials ()
325323
326324 if opts .secretRefreshInterval > 0 && opts .secretBackendCommand == "" {
327325 setupLog .Error (nil , "secretRefreshInterval is set but secretBackendCommand is not configured" )
@@ -340,10 +338,13 @@ func run(opts *options) error {
340338 // to handle that.
341339 <- mgr .Elected ()
342340
343- if rcErr := rcUpdater .Setup (creds ); rcErr != nil {
341+ if rcErr := rcUpdater .Setup (credsManager ); rcErr != nil {
344342 setupErrorf (setupLog , rcErr , "Unable to set up Remote Config service" )
345343 return
346344 }
345+ if opts .secretBackendCommand != "" && opts .secretRefreshInterval > 0 {
346+ go rcUpdater .StartCredentialWatchRoutine (credsManager , opts .secretRefreshInterval )
347+ }
347348
348349 if opts .remoteUpdatesEnabled {
349350 if rcErr := setupFleetDaemon (setupLog , mgr , rcUpdater .Client (), opts .createControllerRevisions && opts .datadogAgentInternalEnabled ); rcErr != nil {
0 commit comments