diff --git a/cmd/provider/accessanalyzer/zz_main.go b/cmd/provider/accessanalyzer/zz_main.go index 6e30372d66..0da2b2ef8b 100644 --- a/cmd/provider/accessanalyzer/zz_main.go +++ b/cmd/provider/accessanalyzer/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/account/zz_main.go b/cmd/provider/account/zz_main.go index f809409824..69b35a34d3 100644 --- a/cmd/provider/account/zz_main.go +++ b/cmd/provider/account/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/acm/zz_main.go b/cmd/provider/acm/zz_main.go index f73502681a..7d03b53415 100644 --- a/cmd/provider/acm/zz_main.go +++ b/cmd/provider/acm/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/acmpca/zz_main.go b/cmd/provider/acmpca/zz_main.go index 88a021e255..a6252f3207 100644 --- a/cmd/provider/acmpca/zz_main.go +++ b/cmd/provider/acmpca/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/amp/zz_main.go b/cmd/provider/amp/zz_main.go index 31ddd0ba83..9113050ae4 100644 --- a/cmd/provider/amp/zz_main.go +++ b/cmd/provider/amp/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/amplify/zz_main.go b/cmd/provider/amplify/zz_main.go index e21b04d13b..12dc288395 100644 --- a/cmd/provider/amplify/zz_main.go +++ b/cmd/provider/amplify/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/apigateway/zz_main.go b/cmd/provider/apigateway/zz_main.go index 38bb29379a..436735189c 100644 --- a/cmd/provider/apigateway/zz_main.go +++ b/cmd/provider/apigateway/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/apigatewayv2/zz_main.go b/cmd/provider/apigatewayv2/zz_main.go index e78e22779f..57b30c8563 100644 --- a/cmd/provider/apigatewayv2/zz_main.go +++ b/cmd/provider/apigatewayv2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appautoscaling/zz_main.go b/cmd/provider/appautoscaling/zz_main.go index f54ce89e3f..e49ee3fbf6 100644 --- a/cmd/provider/appautoscaling/zz_main.go +++ b/cmd/provider/appautoscaling/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appconfig/zz_main.go b/cmd/provider/appconfig/zz_main.go index 0827423f11..d865f83982 100644 --- a/cmd/provider/appconfig/zz_main.go +++ b/cmd/provider/appconfig/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appflow/zz_main.go b/cmd/provider/appflow/zz_main.go index 8c2d89b946..57502e8239 100644 --- a/cmd/provider/appflow/zz_main.go +++ b/cmd/provider/appflow/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appintegrations/zz_main.go b/cmd/provider/appintegrations/zz_main.go index a707d276aa..58784aa2f1 100644 --- a/cmd/provider/appintegrations/zz_main.go +++ b/cmd/provider/appintegrations/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/applicationinsights/zz_main.go b/cmd/provider/applicationinsights/zz_main.go index f67e3fa63e..68e8c0dcb6 100644 --- a/cmd/provider/applicationinsights/zz_main.go +++ b/cmd/provider/applicationinsights/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appmesh/zz_main.go b/cmd/provider/appmesh/zz_main.go index f3188a1fa4..cf8c8a882f 100644 --- a/cmd/provider/appmesh/zz_main.go +++ b/cmd/provider/appmesh/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/apprunner/zz_main.go b/cmd/provider/apprunner/zz_main.go index 38de428ba1..f156ac36fb 100644 --- a/cmd/provider/apprunner/zz_main.go +++ b/cmd/provider/apprunner/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appstream/zz_main.go b/cmd/provider/appstream/zz_main.go index 37a7236c33..51283ae6be 100644 --- a/cmd/provider/appstream/zz_main.go +++ b/cmd/provider/appstream/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/appsync/zz_main.go b/cmd/provider/appsync/zz_main.go index 8d0ecf5dc1..382d413a5f 100644 --- a/cmd/provider/appsync/zz_main.go +++ b/cmd/provider/appsync/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/athena/zz_main.go b/cmd/provider/athena/zz_main.go index 1ad46a5ca0..68e4dd53ab 100644 --- a/cmd/provider/athena/zz_main.go +++ b/cmd/provider/athena/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/autoscaling/zz_main.go b/cmd/provider/autoscaling/zz_main.go index 864c1bb420..642963827a 100644 --- a/cmd/provider/autoscaling/zz_main.go +++ b/cmd/provider/autoscaling/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/autoscalingplans/zz_main.go b/cmd/provider/autoscalingplans/zz_main.go index 19ded881c0..87ec952f8c 100644 --- a/cmd/provider/autoscalingplans/zz_main.go +++ b/cmd/provider/autoscalingplans/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/backup/zz_main.go b/cmd/provider/backup/zz_main.go index d35a13af96..7edf4ab656 100644 --- a/cmd/provider/backup/zz_main.go +++ b/cmd/provider/backup/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/batch/zz_main.go b/cmd/provider/batch/zz_main.go index cbdaeb23d1..8e6ff1846f 100644 --- a/cmd/provider/batch/zz_main.go +++ b/cmd/provider/batch/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/budgets/zz_main.go b/cmd/provider/budgets/zz_main.go index bb6fed7a7b..d124df5842 100644 --- a/cmd/provider/budgets/zz_main.go +++ b/cmd/provider/budgets/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ce/zz_main.go b/cmd/provider/ce/zz_main.go index baa8d51930..550a7d0603 100644 --- a/cmd/provider/ce/zz_main.go +++ b/cmd/provider/ce/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/chime/zz_main.go b/cmd/provider/chime/zz_main.go index b9690a2380..a751e22c38 100644 --- a/cmd/provider/chime/zz_main.go +++ b/cmd/provider/chime/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloud9/zz_main.go b/cmd/provider/cloud9/zz_main.go index bca879094e..0f857ee9ab 100644 --- a/cmd/provider/cloud9/zz_main.go +++ b/cmd/provider/cloud9/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudcontrol/zz_main.go b/cmd/provider/cloudcontrol/zz_main.go index dd095d9683..fec6f545c2 100644 --- a/cmd/provider/cloudcontrol/zz_main.go +++ b/cmd/provider/cloudcontrol/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudformation/zz_main.go b/cmd/provider/cloudformation/zz_main.go index 5cd2c79858..1468c0b26d 100644 --- a/cmd/provider/cloudformation/zz_main.go +++ b/cmd/provider/cloudformation/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudfront/zz_main.go b/cmd/provider/cloudfront/zz_main.go index aa4e443b17..ce969bef21 100644 --- a/cmd/provider/cloudfront/zz_main.go +++ b/cmd/provider/cloudfront/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudsearch/zz_main.go b/cmd/provider/cloudsearch/zz_main.go index d59749fa31..7ea01ba5df 100644 --- a/cmd/provider/cloudsearch/zz_main.go +++ b/cmd/provider/cloudsearch/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudtrail/zz_main.go b/cmd/provider/cloudtrail/zz_main.go index 55f938817f..f8c79b12f0 100644 --- a/cmd/provider/cloudtrail/zz_main.go +++ b/cmd/provider/cloudtrail/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudwatch/zz_main.go b/cmd/provider/cloudwatch/zz_main.go index f830fd7766..d5f24a7996 100644 --- a/cmd/provider/cloudwatch/zz_main.go +++ b/cmd/provider/cloudwatch/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudwatchevents/zz_main.go b/cmd/provider/cloudwatchevents/zz_main.go index c825fe3750..00995c7bfb 100644 --- a/cmd/provider/cloudwatchevents/zz_main.go +++ b/cmd/provider/cloudwatchevents/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cloudwatchlogs/zz_main.go b/cmd/provider/cloudwatchlogs/zz_main.go index b1ce0742df..a061626b93 100644 --- a/cmd/provider/cloudwatchlogs/zz_main.go +++ b/cmd/provider/cloudwatchlogs/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/codecommit/zz_main.go b/cmd/provider/codecommit/zz_main.go index ca5ddf785a..2038ef5b4f 100644 --- a/cmd/provider/codecommit/zz_main.go +++ b/cmd/provider/codecommit/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/codepipeline/zz_main.go b/cmd/provider/codepipeline/zz_main.go index 9414996d19..2da773d380 100644 --- a/cmd/provider/codepipeline/zz_main.go +++ b/cmd/provider/codepipeline/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/codestarconnections/zz_main.go b/cmd/provider/codestarconnections/zz_main.go index 961d0b25c4..4bf08ad564 100644 --- a/cmd/provider/codestarconnections/zz_main.go +++ b/cmd/provider/codestarconnections/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/codestarnotifications/zz_main.go b/cmd/provider/codestarnotifications/zz_main.go index d6b6c074d6..705ae3daea 100644 --- a/cmd/provider/codestarnotifications/zz_main.go +++ b/cmd/provider/codestarnotifications/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cognitoidentity/zz_main.go b/cmd/provider/cognitoidentity/zz_main.go index 3f7b84648a..cf40d6677c 100644 --- a/cmd/provider/cognitoidentity/zz_main.go +++ b/cmd/provider/cognitoidentity/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cognitoidp/zz_main.go b/cmd/provider/cognitoidp/zz_main.go index 3e2355ded5..5358229303 100644 --- a/cmd/provider/cognitoidp/zz_main.go +++ b/cmd/provider/cognitoidp/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/config/zz_main.go b/cmd/provider/config/zz_main.go index 9ab3ed8f53..b83d43715e 100644 --- a/cmd/provider/config/zz_main.go +++ b/cmd/provider/config/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/configservice/zz_main.go b/cmd/provider/configservice/zz_main.go index 42f7da9dff..b28d5184eb 100644 --- a/cmd/provider/configservice/zz_main.go +++ b/cmd/provider/configservice/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/connect/zz_main.go b/cmd/provider/connect/zz_main.go index 927d7ebb50..a01e4cfb8e 100644 --- a/cmd/provider/connect/zz_main.go +++ b/cmd/provider/connect/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/cur/zz_main.go b/cmd/provider/cur/zz_main.go index 879a32af8d..9542923613 100644 --- a/cmd/provider/cur/zz_main.go +++ b/cmd/provider/cur/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/dataexchange/zz_main.go b/cmd/provider/dataexchange/zz_main.go index 9dc75c2e3c..2c0701b325 100644 --- a/cmd/provider/dataexchange/zz_main.go +++ b/cmd/provider/dataexchange/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/datapipeline/zz_main.go b/cmd/provider/datapipeline/zz_main.go index 8fb3f9a34e..470bc6af3b 100644 --- a/cmd/provider/datapipeline/zz_main.go +++ b/cmd/provider/datapipeline/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/datasync/zz_main.go b/cmd/provider/datasync/zz_main.go index 22babe52ba..dbfb4d7d04 100644 --- a/cmd/provider/datasync/zz_main.go +++ b/cmd/provider/datasync/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/dax/zz_main.go b/cmd/provider/dax/zz_main.go index 1e94200e54..f983c9c504 100644 --- a/cmd/provider/dax/zz_main.go +++ b/cmd/provider/dax/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/deploy/zz_main.go b/cmd/provider/deploy/zz_main.go index 5a3408b263..c088699c06 100644 --- a/cmd/provider/deploy/zz_main.go +++ b/cmd/provider/deploy/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/detective/zz_main.go b/cmd/provider/detective/zz_main.go index 6cca90f037..319d4e1889 100644 --- a/cmd/provider/detective/zz_main.go +++ b/cmd/provider/detective/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/devicefarm/zz_main.go b/cmd/provider/devicefarm/zz_main.go index 85c9f961c0..382ef778c1 100644 --- a/cmd/provider/devicefarm/zz_main.go +++ b/cmd/provider/devicefarm/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/directconnect/zz_main.go b/cmd/provider/directconnect/zz_main.go index 6f79675f36..f2c33cf45e 100644 --- a/cmd/provider/directconnect/zz_main.go +++ b/cmd/provider/directconnect/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/dlm/zz_main.go b/cmd/provider/dlm/zz_main.go index 9692dd2567..d1e4b228fb 100644 --- a/cmd/provider/dlm/zz_main.go +++ b/cmd/provider/dlm/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/dms/zz_main.go b/cmd/provider/dms/zz_main.go index 965e158f28..f48972721e 100644 --- a/cmd/provider/dms/zz_main.go +++ b/cmd/provider/dms/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/docdb/zz_main.go b/cmd/provider/docdb/zz_main.go index 2f01d5a6b2..07c7dd4f9e 100644 --- a/cmd/provider/docdb/zz_main.go +++ b/cmd/provider/docdb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ds/zz_main.go b/cmd/provider/ds/zz_main.go index 71a300972b..c4ea6af51c 100644 --- a/cmd/provider/ds/zz_main.go +++ b/cmd/provider/ds/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/dynamodb/zz_main.go b/cmd/provider/dynamodb/zz_main.go index 159d42ffb5..8d39c48d02 100644 --- a/cmd/provider/dynamodb/zz_main.go +++ b/cmd/provider/dynamodb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ec2/zz_main.go b/cmd/provider/ec2/zz_main.go index cac7c795a2..68faf2c4ca 100644 --- a/cmd/provider/ec2/zz_main.go +++ b/cmd/provider/ec2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ecr/zz_main.go b/cmd/provider/ecr/zz_main.go index 2319d83995..bd6a80a0f1 100644 --- a/cmd/provider/ecr/zz_main.go +++ b/cmd/provider/ecr/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ecrpublic/zz_main.go b/cmd/provider/ecrpublic/zz_main.go index 2bb5c18230..d89d548c6e 100644 --- a/cmd/provider/ecrpublic/zz_main.go +++ b/cmd/provider/ecrpublic/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ecs/zz_main.go b/cmd/provider/ecs/zz_main.go index f70f739a71..8202dc7ff4 100644 --- a/cmd/provider/ecs/zz_main.go +++ b/cmd/provider/ecs/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/efs/zz_main.go b/cmd/provider/efs/zz_main.go index 4655c71bb7..aab04717a4 100644 --- a/cmd/provider/efs/zz_main.go +++ b/cmd/provider/efs/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/eks/zz_main.go b/cmd/provider/eks/zz_main.go index f5bebbfae6..06884ab53d 100644 --- a/cmd/provider/eks/zz_main.go +++ b/cmd/provider/eks/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elasticache/zz_main.go b/cmd/provider/elasticache/zz_main.go index 92ca8104d9..9df14c34f3 100644 --- a/cmd/provider/elasticache/zz_main.go +++ b/cmd/provider/elasticache/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elasticbeanstalk/zz_main.go b/cmd/provider/elasticbeanstalk/zz_main.go index dc9be4cff0..4a7f122a5d 100644 --- a/cmd/provider/elasticbeanstalk/zz_main.go +++ b/cmd/provider/elasticbeanstalk/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elasticsearch/zz_main.go b/cmd/provider/elasticsearch/zz_main.go index 1122b2f164..3001488dac 100644 --- a/cmd/provider/elasticsearch/zz_main.go +++ b/cmd/provider/elasticsearch/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elastictranscoder/zz_main.go b/cmd/provider/elastictranscoder/zz_main.go index 43919c325f..521ac652a4 100644 --- a/cmd/provider/elastictranscoder/zz_main.go +++ b/cmd/provider/elastictranscoder/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elb/zz_main.go b/cmd/provider/elb/zz_main.go index edc1dd65f2..73bd336729 100644 --- a/cmd/provider/elb/zz_main.go +++ b/cmd/provider/elb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/elbv2/zz_main.go b/cmd/provider/elbv2/zz_main.go index ccc712098f..43629a21ef 100644 --- a/cmd/provider/elbv2/zz_main.go +++ b/cmd/provider/elbv2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/emr/zz_main.go b/cmd/provider/emr/zz_main.go index 20bc90ca25..ace8f5d51c 100644 --- a/cmd/provider/emr/zz_main.go +++ b/cmd/provider/emr/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/emrserverless/zz_main.go b/cmd/provider/emrserverless/zz_main.go index 7b7cb50f34..b3b8cfaa76 100644 --- a/cmd/provider/emrserverless/zz_main.go +++ b/cmd/provider/emrserverless/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/evidently/zz_main.go b/cmd/provider/evidently/zz_main.go index 49200c4324..dcdcaa1001 100644 --- a/cmd/provider/evidently/zz_main.go +++ b/cmd/provider/evidently/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/firehose/zz_main.go b/cmd/provider/firehose/zz_main.go index 5dc0f2b13a..4b8f23e9e0 100644 --- a/cmd/provider/firehose/zz_main.go +++ b/cmd/provider/firehose/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/fis/zz_main.go b/cmd/provider/fis/zz_main.go index 3847c7e6c9..82966ca505 100644 --- a/cmd/provider/fis/zz_main.go +++ b/cmd/provider/fis/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/fsx/zz_main.go b/cmd/provider/fsx/zz_main.go index ae195f1945..0ee61b860e 100644 --- a/cmd/provider/fsx/zz_main.go +++ b/cmd/provider/fsx/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/gamelift/zz_main.go b/cmd/provider/gamelift/zz_main.go index 6a6a93c483..c9077d902c 100644 --- a/cmd/provider/gamelift/zz_main.go +++ b/cmd/provider/gamelift/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/glacier/zz_main.go b/cmd/provider/glacier/zz_main.go index 57e25b2489..ccf57bee88 100644 --- a/cmd/provider/glacier/zz_main.go +++ b/cmd/provider/glacier/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/globalaccelerator/zz_main.go b/cmd/provider/globalaccelerator/zz_main.go index eed2510585..edbf7f3988 100644 --- a/cmd/provider/globalaccelerator/zz_main.go +++ b/cmd/provider/globalaccelerator/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/glue/zz_main.go b/cmd/provider/glue/zz_main.go index e7a6722ef8..7434ce26b5 100644 --- a/cmd/provider/glue/zz_main.go +++ b/cmd/provider/glue/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/grafana/zz_main.go b/cmd/provider/grafana/zz_main.go index b6d654a924..10df44fa97 100644 --- a/cmd/provider/grafana/zz_main.go +++ b/cmd/provider/grafana/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/guardduty/zz_main.go b/cmd/provider/guardduty/zz_main.go index 7775d5da96..2ad857ba49 100644 --- a/cmd/provider/guardduty/zz_main.go +++ b/cmd/provider/guardduty/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/iam/zz_main.go b/cmd/provider/iam/zz_main.go index 2a6f4fdef5..a2737f8638 100644 --- a/cmd/provider/iam/zz_main.go +++ b/cmd/provider/iam/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/identitystore/zz_main.go b/cmd/provider/identitystore/zz_main.go index 05c1132d09..c33013e570 100644 --- a/cmd/provider/identitystore/zz_main.go +++ b/cmd/provider/identitystore/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/imagebuilder/zz_main.go b/cmd/provider/imagebuilder/zz_main.go index 3aee2bd62f..ebfdce23dc 100644 --- a/cmd/provider/imagebuilder/zz_main.go +++ b/cmd/provider/imagebuilder/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/inspector/zz_main.go b/cmd/provider/inspector/zz_main.go index 38897ff80b..2a78bd9a7e 100644 --- a/cmd/provider/inspector/zz_main.go +++ b/cmd/provider/inspector/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/inspector2/zz_main.go b/cmd/provider/inspector2/zz_main.go index c3303e8773..56184ae79d 100644 --- a/cmd/provider/inspector2/zz_main.go +++ b/cmd/provider/inspector2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/iot/zz_main.go b/cmd/provider/iot/zz_main.go index db9363668d..b7502ae91d 100644 --- a/cmd/provider/iot/zz_main.go +++ b/cmd/provider/iot/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ivs/zz_main.go b/cmd/provider/ivs/zz_main.go index b21b47081f..90770cb443 100644 --- a/cmd/provider/ivs/zz_main.go +++ b/cmd/provider/ivs/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kafka/zz_main.go b/cmd/provider/kafka/zz_main.go index bc9e2278dd..c52121565f 100644 --- a/cmd/provider/kafka/zz_main.go +++ b/cmd/provider/kafka/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kendra/zz_main.go b/cmd/provider/kendra/zz_main.go index da665d48fc..01ea5c5c59 100644 --- a/cmd/provider/kendra/zz_main.go +++ b/cmd/provider/kendra/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/keyspaces/zz_main.go b/cmd/provider/keyspaces/zz_main.go index 530f1e1988..93dea40584 100644 --- a/cmd/provider/keyspaces/zz_main.go +++ b/cmd/provider/keyspaces/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kinesis/zz_main.go b/cmd/provider/kinesis/zz_main.go index f21dedc16e..40b0f7f157 100644 --- a/cmd/provider/kinesis/zz_main.go +++ b/cmd/provider/kinesis/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kinesisanalytics/zz_main.go b/cmd/provider/kinesisanalytics/zz_main.go index 749a46ca44..f13e6180b0 100644 --- a/cmd/provider/kinesisanalytics/zz_main.go +++ b/cmd/provider/kinesisanalytics/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kinesisanalyticsv2/zz_main.go b/cmd/provider/kinesisanalyticsv2/zz_main.go index 32f21b2f09..c2dab22b33 100644 --- a/cmd/provider/kinesisanalyticsv2/zz_main.go +++ b/cmd/provider/kinesisanalyticsv2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kinesisvideo/zz_main.go b/cmd/provider/kinesisvideo/zz_main.go index df18d456d5..a3f4b15aa9 100644 --- a/cmd/provider/kinesisvideo/zz_main.go +++ b/cmd/provider/kinesisvideo/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/kms/zz_main.go b/cmd/provider/kms/zz_main.go index 1c12d38771..96ef42c918 100644 --- a/cmd/provider/kms/zz_main.go +++ b/cmd/provider/kms/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/lakeformation/zz_main.go b/cmd/provider/lakeformation/zz_main.go index 81b7d7c819..240b78a64a 100644 --- a/cmd/provider/lakeformation/zz_main.go +++ b/cmd/provider/lakeformation/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/lambda/zz_main.go b/cmd/provider/lambda/zz_main.go index cccf82f291..70b77c8fa3 100644 --- a/cmd/provider/lambda/zz_main.go +++ b/cmd/provider/lambda/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/lexmodels/zz_main.go b/cmd/provider/lexmodels/zz_main.go index 392c42fd66..6f1d6f16a1 100644 --- a/cmd/provider/lexmodels/zz_main.go +++ b/cmd/provider/lexmodels/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/licensemanager/zz_main.go b/cmd/provider/licensemanager/zz_main.go index 76a899fcfe..2e499805a4 100644 --- a/cmd/provider/licensemanager/zz_main.go +++ b/cmd/provider/licensemanager/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/lightsail/zz_main.go b/cmd/provider/lightsail/zz_main.go index 7231814f43..541c761c4c 100644 --- a/cmd/provider/lightsail/zz_main.go +++ b/cmd/provider/lightsail/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/location/zz_main.go b/cmd/provider/location/zz_main.go index 1b900c24d1..dcc6d1af4b 100644 --- a/cmd/provider/location/zz_main.go +++ b/cmd/provider/location/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/macie2/zz_main.go b/cmd/provider/macie2/zz_main.go index 30cd3371e6..a8660357a1 100644 --- a/cmd/provider/macie2/zz_main.go +++ b/cmd/provider/macie2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/mediaconvert/zz_main.go b/cmd/provider/mediaconvert/zz_main.go index 7c685985c9..2354a3f21d 100644 --- a/cmd/provider/mediaconvert/zz_main.go +++ b/cmd/provider/mediaconvert/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/medialive/zz_main.go b/cmd/provider/medialive/zz_main.go index 78632dfa32..9451d8aa54 100644 --- a/cmd/provider/medialive/zz_main.go +++ b/cmd/provider/medialive/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/mediapackage/zz_main.go b/cmd/provider/mediapackage/zz_main.go index a9e4ce6abb..d1bc46f6f1 100644 --- a/cmd/provider/mediapackage/zz_main.go +++ b/cmd/provider/mediapackage/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/mediastore/zz_main.go b/cmd/provider/mediastore/zz_main.go index f4a06c7c91..d60f5ad6a4 100644 --- a/cmd/provider/mediastore/zz_main.go +++ b/cmd/provider/mediastore/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/memorydb/zz_main.go b/cmd/provider/memorydb/zz_main.go index a1091e0538..9e32df5867 100644 --- a/cmd/provider/memorydb/zz_main.go +++ b/cmd/provider/memorydb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/monolith/zz_main.go b/cmd/provider/monolith/zz_main.go index 35ace28ff6..d1ac879d78 100644 --- a/cmd/provider/monolith/zz_main.go +++ b/cmd/provider/monolith/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/mq/zz_main.go b/cmd/provider/mq/zz_main.go index 726b3d2a4f..9fef6249a8 100644 --- a/cmd/provider/mq/zz_main.go +++ b/cmd/provider/mq/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/neptune/zz_main.go b/cmd/provider/neptune/zz_main.go index a3f86a02a3..4b190fad19 100644 --- a/cmd/provider/neptune/zz_main.go +++ b/cmd/provider/neptune/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/networkfirewall/zz_main.go b/cmd/provider/networkfirewall/zz_main.go index 16da65f93f..96ddf79139 100644 --- a/cmd/provider/networkfirewall/zz_main.go +++ b/cmd/provider/networkfirewall/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/networkmanager/zz_main.go b/cmd/provider/networkmanager/zz_main.go index 96ce3d1c12..ef804c4887 100644 --- a/cmd/provider/networkmanager/zz_main.go +++ b/cmd/provider/networkmanager/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/opensearch/zz_main.go b/cmd/provider/opensearch/zz_main.go index 25a145a95b..0a04b0b9b0 100644 --- a/cmd/provider/opensearch/zz_main.go +++ b/cmd/provider/opensearch/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/opensearchserverless/zz_main.go b/cmd/provider/opensearchserverless/zz_main.go index 3f98c1d509..b1c23ded1f 100644 --- a/cmd/provider/opensearchserverless/zz_main.go +++ b/cmd/provider/opensearchserverless/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/opsworks/zz_main.go b/cmd/provider/opsworks/zz_main.go index dbc51a3fc4..ae0799298b 100644 --- a/cmd/provider/opsworks/zz_main.go +++ b/cmd/provider/opsworks/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/organizations/zz_main.go b/cmd/provider/organizations/zz_main.go index da952133f3..dd56c99df2 100644 --- a/cmd/provider/organizations/zz_main.go +++ b/cmd/provider/organizations/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/pinpoint/zz_main.go b/cmd/provider/pinpoint/zz_main.go index ea73153f2e..92bd603924 100644 --- a/cmd/provider/pinpoint/zz_main.go +++ b/cmd/provider/pinpoint/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/qldb/zz_main.go b/cmd/provider/qldb/zz_main.go index f8be266de8..4c5b10064c 100644 --- a/cmd/provider/qldb/zz_main.go +++ b/cmd/provider/qldb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/quicksight/zz_main.go b/cmd/provider/quicksight/zz_main.go index 1f4a9a93b4..762e8da228 100644 --- a/cmd/provider/quicksight/zz_main.go +++ b/cmd/provider/quicksight/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ram/zz_main.go b/cmd/provider/ram/zz_main.go index 9040624596..efb1d78245 100644 --- a/cmd/provider/ram/zz_main.go +++ b/cmd/provider/ram/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/rds/zz_main.go b/cmd/provider/rds/zz_main.go index f84b29cbaf..f92f432d20 100644 --- a/cmd/provider/rds/zz_main.go +++ b/cmd/provider/rds/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/redshift/zz_main.go b/cmd/provider/redshift/zz_main.go index 07bc245b4e..f0b4df8bc5 100644 --- a/cmd/provider/redshift/zz_main.go +++ b/cmd/provider/redshift/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/redshiftserverless/zz_main.go b/cmd/provider/redshiftserverless/zz_main.go index 628e53a707..66e821a4f9 100644 --- a/cmd/provider/redshiftserverless/zz_main.go +++ b/cmd/provider/redshiftserverless/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/resourcegroups/zz_main.go b/cmd/provider/resourcegroups/zz_main.go index 97d5d335b2..42d95eaa46 100644 --- a/cmd/provider/resourcegroups/zz_main.go +++ b/cmd/provider/resourcegroups/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/rolesanywhere/zz_main.go b/cmd/provider/rolesanywhere/zz_main.go index 05ef81c6cb..495ef75f7a 100644 --- a/cmd/provider/rolesanywhere/zz_main.go +++ b/cmd/provider/rolesanywhere/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/route53/zz_main.go b/cmd/provider/route53/zz_main.go index 2853174811..cf61aa441c 100644 --- a/cmd/provider/route53/zz_main.go +++ b/cmd/provider/route53/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/route53recoverycontrolconfig/zz_main.go b/cmd/provider/route53recoverycontrolconfig/zz_main.go index 7f7472458f..f24474f0d4 100644 --- a/cmd/provider/route53recoverycontrolconfig/zz_main.go +++ b/cmd/provider/route53recoverycontrolconfig/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/route53recoveryreadiness/zz_main.go b/cmd/provider/route53recoveryreadiness/zz_main.go index b12d4551bc..f13143f837 100644 --- a/cmd/provider/route53recoveryreadiness/zz_main.go +++ b/cmd/provider/route53recoveryreadiness/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/route53resolver/zz_main.go b/cmd/provider/route53resolver/zz_main.go index 676590e178..0843afd8e4 100644 --- a/cmd/provider/route53resolver/zz_main.go +++ b/cmd/provider/route53resolver/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/rum/zz_main.go b/cmd/provider/rum/zz_main.go index e055298b24..caac89e707 100644 --- a/cmd/provider/rum/zz_main.go +++ b/cmd/provider/rum/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/s3/zz_main.go b/cmd/provider/s3/zz_main.go index 9dd540b8ea..aa16d88658 100644 --- a/cmd/provider/s3/zz_main.go +++ b/cmd/provider/s3/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/s3control/zz_main.go b/cmd/provider/s3control/zz_main.go index 184d94b2e0..62de259485 100644 --- a/cmd/provider/s3control/zz_main.go +++ b/cmd/provider/s3control/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/sagemaker/zz_main.go b/cmd/provider/sagemaker/zz_main.go index c08c7e241b..7fd7c9ed80 100644 --- a/cmd/provider/sagemaker/zz_main.go +++ b/cmd/provider/sagemaker/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/scheduler/zz_main.go b/cmd/provider/scheduler/zz_main.go index 71023e4736..2b2b75bf23 100644 --- a/cmd/provider/scheduler/zz_main.go +++ b/cmd/provider/scheduler/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/schemas/zz_main.go b/cmd/provider/schemas/zz_main.go index 72a7d8a9d2..5a22a937f4 100644 --- a/cmd/provider/schemas/zz_main.go +++ b/cmd/provider/schemas/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/secretsmanager/zz_main.go b/cmd/provider/secretsmanager/zz_main.go index c57f3b46da..2f0c01c4e9 100644 --- a/cmd/provider/secretsmanager/zz_main.go +++ b/cmd/provider/secretsmanager/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/securityhub/zz_main.go b/cmd/provider/securityhub/zz_main.go index 38b2962669..e3cf195db3 100644 --- a/cmd/provider/securityhub/zz_main.go +++ b/cmd/provider/securityhub/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/serverlessrepo/zz_main.go b/cmd/provider/serverlessrepo/zz_main.go index c9c893886c..a74b7f536f 100644 --- a/cmd/provider/serverlessrepo/zz_main.go +++ b/cmd/provider/serverlessrepo/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/servicecatalog/zz_main.go b/cmd/provider/servicecatalog/zz_main.go index 6bbe3df387..aff99d7e36 100644 --- a/cmd/provider/servicecatalog/zz_main.go +++ b/cmd/provider/servicecatalog/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/servicediscovery/zz_main.go b/cmd/provider/servicediscovery/zz_main.go index a3d6cfba50..fae66bbc6a 100644 --- a/cmd/provider/servicediscovery/zz_main.go +++ b/cmd/provider/servicediscovery/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/servicequotas/zz_main.go b/cmd/provider/servicequotas/zz_main.go index 9d86aafa9a..5e92f5d8a0 100644 --- a/cmd/provider/servicequotas/zz_main.go +++ b/cmd/provider/servicequotas/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ses/zz_main.go b/cmd/provider/ses/zz_main.go index e20f96f501..250a3da547 100644 --- a/cmd/provider/ses/zz_main.go +++ b/cmd/provider/ses/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/sesv2/zz_main.go b/cmd/provider/sesv2/zz_main.go index 80a03d8c2e..65fb200aef 100644 --- a/cmd/provider/sesv2/zz_main.go +++ b/cmd/provider/sesv2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/sfn/zz_main.go b/cmd/provider/sfn/zz_main.go index 05a94e59c5..e8f42e441a 100644 --- a/cmd/provider/sfn/zz_main.go +++ b/cmd/provider/sfn/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/signer/zz_main.go b/cmd/provider/signer/zz_main.go index efa0b5eafe..3ee2fdbcec 100644 --- a/cmd/provider/signer/zz_main.go +++ b/cmd/provider/signer/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/simpledb/zz_main.go b/cmd/provider/simpledb/zz_main.go index 5c75de0e35..17b6bce3db 100644 --- a/cmd/provider/simpledb/zz_main.go +++ b/cmd/provider/simpledb/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/sns/zz_main.go b/cmd/provider/sns/zz_main.go index 8ee17569f0..d43540d22b 100644 --- a/cmd/provider/sns/zz_main.go +++ b/cmd/provider/sns/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/sqs/zz_main.go b/cmd/provider/sqs/zz_main.go index 0e26083aab..6f6390df6f 100644 --- a/cmd/provider/sqs/zz_main.go +++ b/cmd/provider/sqs/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ssm/zz_main.go b/cmd/provider/ssm/zz_main.go index 8f58d6ac45..ec88058121 100644 --- a/cmd/provider/ssm/zz_main.go +++ b/cmd/provider/ssm/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/ssoadmin/zz_main.go b/cmd/provider/ssoadmin/zz_main.go index acc3dce851..c0d1bd270d 100644 --- a/cmd/provider/ssoadmin/zz_main.go +++ b/cmd/provider/ssoadmin/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/swf/zz_main.go b/cmd/provider/swf/zz_main.go index 6569f7f19c..3ac27e7ab3 100644 --- a/cmd/provider/swf/zz_main.go +++ b/cmd/provider/swf/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/timestreamwrite/zz_main.go b/cmd/provider/timestreamwrite/zz_main.go index 2bf6e57c65..0b87b20570 100644 --- a/cmd/provider/timestreamwrite/zz_main.go +++ b/cmd/provider/timestreamwrite/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/transcribe/zz_main.go b/cmd/provider/transcribe/zz_main.go index 96f56c0756..4ec13902ff 100644 --- a/cmd/provider/transcribe/zz_main.go +++ b/cmd/provider/transcribe/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/transfer/zz_main.go b/cmd/provider/transfer/zz_main.go index 1e97f65419..faac6cc7ae 100644 --- a/cmd/provider/transfer/zz_main.go +++ b/cmd/provider/transfer/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/vpc/zz_main.go b/cmd/provider/vpc/zz_main.go index 8538a1cf07..973557f901 100644 --- a/cmd/provider/vpc/zz_main.go +++ b/cmd/provider/vpc/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/waf/zz_main.go b/cmd/provider/waf/zz_main.go index b3c39c733a..6e1d5176cb 100644 --- a/cmd/provider/waf/zz_main.go +++ b/cmd/provider/waf/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/wafregional/zz_main.go b/cmd/provider/wafregional/zz_main.go index d53ebf4dd2..b06689e90a 100644 --- a/cmd/provider/wafregional/zz_main.go +++ b/cmd/provider/wafregional/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/wafv2/zz_main.go b/cmd/provider/wafv2/zz_main.go index c742960f64..71e7139bed 100644 --- a/cmd/provider/wafv2/zz_main.go +++ b/cmd/provider/wafv2/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/workspaces/zz_main.go b/cmd/provider/workspaces/zz_main.go index 47a47499e5..f35f348ee7 100644 --- a/cmd/provider/workspaces/zz_main.go +++ b/cmd/provider/workspaces/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/cmd/provider/xray/zz_main.go b/cmd/provider/xray/zz_main.go index 1e727eac2c..97997f7e8c 100644 --- a/cmd/provider/xray/zz_main.go +++ b/cmd/provider/xray/zz_main.go @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.") diff --git a/hack/main.go.tmpl b/hack/main.go.tmpl index 6fceb77ac8..e3fa7d935a 100644 --- a/hack/main.go.tmpl +++ b/hack/main.go.tmpl @@ -7,6 +7,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -84,9 +86,11 @@ func main() { ) setupConfig := &clients.SetupConfig{} kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) zl := zap.New(zap.UseDevMode(*debug)) - log := logging.NewLogrLogger(zl.WithName("provider-aws")) + logr := logging.NewLogrLogger(zl.WithName("provider-aws")) if *debug { // The controller-runtime runs with a no-op logger by default. It is // *very* verbose even at info level, so we only provide it a real @@ -96,7 +100,7 @@ func main() { // currently, we configure the jitter to be the 5% of the poll interval pollJitter := time.Duration(float64(*pollInterval) * 0.05) - log.Debug("Starting", "sync-interval", syncInterval.String(), + logr.Debug("Starting", "sync-interval", syncInterval.String(), "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) cfg, err := ctrl.GetConfig() @@ -148,7 +152,7 @@ func main() { setupConfig.TerraformProvider = provider.TerraformProvider o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -157,22 +161,22 @@ func main() { Provider: provider, SetupFn: clients.SelectTerraformSetup(setupConfig), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), StartWebhooks: *certsDir != "", } if *enableManagementPolicies { o.Features.Enable(features.EnableBetaManagementPolicies) - log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) } if *enableExternalSecretStores { o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) o.ESSOptions = &tjcontroller.ESSOptions{} if *essTLSCertsPath != "" { - log.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) kingpin.FatalIfError(err, "Cannot load ESS TLS config.")