diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index c77b21ef0..f7ade82dd 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -12,4 +12,4 @@ on: jobs: backport: - uses: upbound/uptest/.github/workflows/provider-backport.yml@main + uses: upbound/uptest/.github/workflows/provider-backport.yml@standard-runners diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bd6bcb15..1bf94205d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,10 @@ on: jobs: ci: - uses: upbound/uptest/.github/workflows/provider-ci.yml@main + uses: upbound/uptest/.github/workflows/provider-ci.yml@standard-runners with: go-version: 1.21 + cleanup-disk: true secrets: UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index cbbd0db78..5564ecee2 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -4,4 +4,4 @@ on: issue_comment jobs: comment-commands: - uses: upbound/uptest/.github/workflows/provider-commands.yml@main + uses: upbound/uptest/.github/workflows/provider-commands.yml@standard-runners diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 28ca5200f..26ad686f0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -6,9 +6,10 @@ on: jobs: e2e: - uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@main + uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@standard-runners with: go-version: 1.21 + cleanup-disk: true secrets: UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }} UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }} \ No newline at end of file diff --git a/.github/workflows/issue_triage.yml b/.github/workflows/issue_triage.yml index 09657b26e..2473cf5dd 100644 --- a/.github/workflows/issue_triage.yml +++ b/.github/workflows/issue_triage.yml @@ -8,6 +8,6 @@ on: jobs: community-issue-triage: - uses: upbound/uptest/.github/workflows/issue-triage.yml@main + uses: upbound/uptest/.github/workflows/issue-triage.yml@standard-runners secrets: UPBOUND_BOT_GITHUB_TOKEN: ${{ secrets.UPBOUND_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/native-provider-bump.yml b/.github/workflows/native-provider-bump.yml index 1bbfd2fda..4875bf0e6 100644 --- a/.github/workflows/native-provider-bump.yml +++ b/.github/workflows/native-provider-bump.yml @@ -5,7 +5,7 @@ on: jobs: open-bump-pr: - uses: upbound/uptest/.github/workflows/native-provider-bump.yml@main + uses: upbound/uptest/.github/workflows/native-provider-bump.yml@standard-runners with: provider-source: hashicorp/google go-version: 1.21 diff --git a/.github/workflows/publish-service-artifacts.yml b/.github/workflows/publish-service-artifacts.yml index ec4f2aaff..0e2e0f2b7 100644 --- a/.github/workflows/publish-service-artifacts.yml +++ b/.github/workflows/publish-service-artifacts.yml @@ -18,12 +18,13 @@ on: jobs: publish-service-artifacts: - uses: upbound/uptest/.github/workflows/provider-publish-service-artifacts.yml@main + uses: upbound/uptest/.github/workflows/provider-publish-service-artifacts.yml@standard-runners with: subpackages: ${{ github.event.inputs.subpackages }} size: ${{ github.event.inputs.size }} concurrency: ${{ github.event.inputs.concurrency }} go-version: 1.21 + cleanup-disk: true secrets: UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR_RC }} UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW_RC }} diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index b59940c1a..fef6afbe3 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -40,7 +40,7 @@ jobs: echo "We are going to scan the last ${supported_releases_number} releases for: ${images}" scan: - uses: upbound/uptest/.github/workflows/scan.yml@main + uses: upbound/uptest/.github/workflows/scan.yml@standard-runners needs: - setup-vars with: diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 2a93895ad..086c6f4dc 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -12,7 +12,7 @@ on: jobs: tag: - uses: upbound/uptest/.github/workflows/provider-tag.yml@main + uses: upbound/uptest/.github/workflows/provider-tag.yml@standard-runners with: version: ${{ github.event.inputs.version }} message: ${{ github.event.inputs.message }} diff --git a/.github/workflows/updoc.yml b/.github/workflows/updoc.yml index 767495349..a8487b713 100644 --- a/.github/workflows/updoc.yml +++ b/.github/workflows/updoc.yml @@ -5,7 +5,7 @@ on: jobs: publish-docs: - uses: upbound/uptest/.github/workflows/provider-updoc.yml@main + uses: upbound/uptest/.github/workflows/provider-updoc.yml@standard-runners with: providers: "monolith config" go-version: 1.21 diff --git a/Makefile b/Makefile index 5e8c80029..1b5683e21 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,7 @@ UPTEST_VERSION = v0.8.0 # dependency for up UP_VERSION = v0.20.0 UP_CHANNEL = stable +UXP_VERSION = 1.14.6-up.1 export UP_VERSION := $(UP_VERSION) export UP_CHANNEL := $(UP_CHANNEL) diff --git a/build b/build index a6e25afa0..75a9fe3ae 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit a6e25afa0d43da62b11af96a5d29627a52f32cd9 +Subproject commit 75a9fe3ae6b6de82c5f7ddc6a267617940f16b83 diff --git a/cmd/provider/accesscontextmanager/zz_main.go b/cmd/provider/accesscontextmanager/zz_main.go index 9847eca69..28e0d9334 100644 --- a/cmd/provider/accesscontextmanager/zz_main.go +++ b/cmd/provider/accesscontextmanager/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/activedirectory/zz_main.go b/cmd/provider/activedirectory/zz_main.go index 270ba25b8..439c792c4 100644 --- a/cmd/provider/activedirectory/zz_main.go +++ b/cmd/provider/activedirectory/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/alloydb/zz_main.go b/cmd/provider/alloydb/zz_main.go index 31b08681d..21b747754 100644 --- a/cmd/provider/alloydb/zz_main.go +++ b/cmd/provider/alloydb/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/apigee/zz_main.go b/cmd/provider/apigee/zz_main.go index 6c0c7c50a..6bd4bc8eb 100644 --- a/cmd/provider/apigee/zz_main.go +++ b/cmd/provider/apigee/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/appengine/zz_main.go b/cmd/provider/appengine/zz_main.go index 45539c947..b5a264d04 100644 --- a/cmd/provider/appengine/zz_main.go +++ b/cmd/provider/appengine/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/artifact/zz_main.go b/cmd/provider/artifact/zz_main.go index 0103eed91..325965833 100644 --- a/cmd/provider/artifact/zz_main.go +++ b/cmd/provider/artifact/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/beyondcorp/zz_main.go b/cmd/provider/beyondcorp/zz_main.go index 24c058adb..2e2de5bfe 100644 --- a/cmd/provider/beyondcorp/zz_main.go +++ b/cmd/provider/beyondcorp/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/bigquery/zz_main.go b/cmd/provider/bigquery/zz_main.go index d0e2dcb6f..7dfa84b1f 100644 --- a/cmd/provider/bigquery/zz_main.go +++ b/cmd/provider/bigquery/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/bigtable/zz_main.go b/cmd/provider/bigtable/zz_main.go index 7750a421e..7139e8b46 100644 --- a/cmd/provider/bigtable/zz_main.go +++ b/cmd/provider/bigtable/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/binaryauthorization/zz_main.go b/cmd/provider/binaryauthorization/zz_main.go index 9c4723980..4ebb6e60b 100644 --- a/cmd/provider/binaryauthorization/zz_main.go +++ b/cmd/provider/binaryauthorization/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/certificatemanager/zz_main.go b/cmd/provider/certificatemanager/zz_main.go index cb3b4af6e..32780362c 100644 --- a/cmd/provider/certificatemanager/zz_main.go +++ b/cmd/provider/certificatemanager/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloud/zz_main.go b/cmd/provider/cloud/zz_main.go index 65b692575..ceb508e77 100644 --- a/cmd/provider/cloud/zz_main.go +++ b/cmd/provider/cloud/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudbuild/zz_main.go b/cmd/provider/cloudbuild/zz_main.go index 411beb684..6df56684c 100644 --- a/cmd/provider/cloudbuild/zz_main.go +++ b/cmd/provider/cloudbuild/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudfunctions/zz_main.go b/cmd/provider/cloudfunctions/zz_main.go index d19d38405..4a51e5d9a 100644 --- a/cmd/provider/cloudfunctions/zz_main.go +++ b/cmd/provider/cloudfunctions/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudfunctions2/zz_main.go b/cmd/provider/cloudfunctions2/zz_main.go index 0f37a79c8..187163169 100644 --- a/cmd/provider/cloudfunctions2/zz_main.go +++ b/cmd/provider/cloudfunctions2/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudiot/zz_main.go b/cmd/provider/cloudiot/zz_main.go index 2dc9b796c..985657b06 100644 --- a/cmd/provider/cloudiot/zz_main.go +++ b/cmd/provider/cloudiot/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudplatform/zz_main.go b/cmd/provider/cloudplatform/zz_main.go index 5dda2a075..8eeab8644 100644 --- a/cmd/provider/cloudplatform/zz_main.go +++ b/cmd/provider/cloudplatform/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudrun/zz_main.go b/cmd/provider/cloudrun/zz_main.go index a623d9ab7..f074915f2 100644 --- a/cmd/provider/cloudrun/zz_main.go +++ b/cmd/provider/cloudrun/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudscheduler/zz_main.go b/cmd/provider/cloudscheduler/zz_main.go index c5e4c68a0..05b270680 100644 --- a/cmd/provider/cloudscheduler/zz_main.go +++ b/cmd/provider/cloudscheduler/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/cloudtasks/zz_main.go b/cmd/provider/cloudtasks/zz_main.go index 49a473999..569ab5bae 100644 --- a/cmd/provider/cloudtasks/zz_main.go +++ b/cmd/provider/cloudtasks/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/composer/zz_main.go b/cmd/provider/composer/zz_main.go index 16dd0fd9f..a4905b08f 100644 --- a/cmd/provider/composer/zz_main.go +++ b/cmd/provider/composer/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/compute/zz_main.go b/cmd/provider/compute/zz_main.go index 641c67359..006a3673f 100644 --- a/cmd/provider/compute/zz_main.go +++ b/cmd/provider/compute/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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 72b5a428c..9879e2220 100644 --- a/cmd/provider/config/zz_main.go +++ b/cmd/provider/config/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/container/zz_main.go b/cmd/provider/container/zz_main.go index 83236527a..c60bbbda4 100644 --- a/cmd/provider/container/zz_main.go +++ b/cmd/provider/container/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/containeranalysis/zz_main.go b/cmd/provider/containeranalysis/zz_main.go index 39fb8863b..68128b9be 100644 --- a/cmd/provider/containeranalysis/zz_main.go +++ b/cmd/provider/containeranalysis/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/containeraws/zz_main.go b/cmd/provider/containeraws/zz_main.go index 4bdf348f4..031cb3dcb 100644 --- a/cmd/provider/containeraws/zz_main.go +++ b/cmd/provider/containeraws/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/containerazure/zz_main.go b/cmd/provider/containerazure/zz_main.go index de9e27c3f..f43d10771 100644 --- a/cmd/provider/containerazure/zz_main.go +++ b/cmd/provider/containerazure/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/datacatalog/zz_main.go b/cmd/provider/datacatalog/zz_main.go index 1a7aca805..9a8f3db01 100644 --- a/cmd/provider/datacatalog/zz_main.go +++ b/cmd/provider/datacatalog/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/dataflow/zz_main.go b/cmd/provider/dataflow/zz_main.go index c513365ef..9a1d77969 100644 --- a/cmd/provider/dataflow/zz_main.go +++ b/cmd/provider/dataflow/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/datafusion/zz_main.go b/cmd/provider/datafusion/zz_main.go index bd24d7ed2..fb79a31b3 100644 --- a/cmd/provider/datafusion/zz_main.go +++ b/cmd/provider/datafusion/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/datalossprevention/zz_main.go b/cmd/provider/datalossprevention/zz_main.go index bffe4bc69..bdee8d871 100644 --- a/cmd/provider/datalossprevention/zz_main.go +++ b/cmd/provider/datalossprevention/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/dataplex/zz_main.go b/cmd/provider/dataplex/zz_main.go index 39eceec0c..c3163097d 100644 --- a/cmd/provider/dataplex/zz_main.go +++ b/cmd/provider/dataplex/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/dataproc/zz_main.go b/cmd/provider/dataproc/zz_main.go index 8687da1fd..ed7f8221c 100644 --- a/cmd/provider/dataproc/zz_main.go +++ b/cmd/provider/dataproc/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/datastore/zz_main.go b/cmd/provider/datastore/zz_main.go index 157396ef4..8cbf5bd0b 100644 --- a/cmd/provider/datastore/zz_main.go +++ b/cmd/provider/datastore/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/datastream/zz_main.go b/cmd/provider/datastream/zz_main.go index 5f6924c41..06276992a 100644 --- a/cmd/provider/datastream/zz_main.go +++ b/cmd/provider/datastream/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/dialogflowcx/zz_main.go b/cmd/provider/dialogflowcx/zz_main.go index dc4c09f67..d8e961be1 100644 --- a/cmd/provider/dialogflowcx/zz_main.go +++ b/cmd/provider/dialogflowcx/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/dns/zz_main.go b/cmd/provider/dns/zz_main.go index 32b1f0d2e..bbc9b0416 100644 --- a/cmd/provider/dns/zz_main.go +++ b/cmd/provider/dns/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/documentai/zz_main.go b/cmd/provider/documentai/zz_main.go index e3f6a704d..df80cbcd6 100644 --- a/cmd/provider/documentai/zz_main.go +++ b/cmd/provider/documentai/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/essentialcontacts/zz_main.go b/cmd/provider/essentialcontacts/zz_main.go index d5bd70159..692e360ea 100644 --- a/cmd/provider/essentialcontacts/zz_main.go +++ b/cmd/provider/essentialcontacts/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/eventarc/zz_main.go b/cmd/provider/eventarc/zz_main.go index be60664f8..b765d8261 100644 --- a/cmd/provider/eventarc/zz_main.go +++ b/cmd/provider/eventarc/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/filestore/zz_main.go b/cmd/provider/filestore/zz_main.go index af3138cd4..0c0cf77ec 100644 --- a/cmd/provider/filestore/zz_main.go +++ b/cmd/provider/filestore/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/firebaserules/zz_main.go b/cmd/provider/firebaserules/zz_main.go index 90754d34c..4f6994ce4 100644 --- a/cmd/provider/firebaserules/zz_main.go +++ b/cmd/provider/firebaserules/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/gke/zz_main.go b/cmd/provider/gke/zz_main.go index 719bac391..8f9adfa00 100644 --- a/cmd/provider/gke/zz_main.go +++ b/cmd/provider/gke/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/gkehub/zz_main.go b/cmd/provider/gkehub/zz_main.go index 68eb54b96..a2855498c 100644 --- a/cmd/provider/gkehub/zz_main.go +++ b/cmd/provider/gkehub/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/healthcare/zz_main.go b/cmd/provider/healthcare/zz_main.go index 3df1f2fa2..5ffa8a846 100644 --- a/cmd/provider/healthcare/zz_main.go +++ b/cmd/provider/healthcare/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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 645635158..d9ad9468c 100644 --- a/cmd/provider/iam/zz_main.go +++ b/cmd/provider/iam/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/iap/zz_main.go b/cmd/provider/iap/zz_main.go index 07c527d08..0b95b102e 100644 --- a/cmd/provider/iap/zz_main.go +++ b/cmd/provider/iap/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/identityplatform/zz_main.go b/cmd/provider/identityplatform/zz_main.go index cfd47c8e7..9f074b004 100644 --- a/cmd/provider/identityplatform/zz_main.go +++ b/cmd/provider/identityplatform/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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 890b1a43e..2ad3205ba 100644 --- a/cmd/provider/kms/zz_main.go +++ b/cmd/provider/kms/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/logging/zz_main.go b/cmd/provider/logging/zz_main.go index c410f1d07..fb01d02bc 100644 --- a/cmd/provider/logging/zz_main.go +++ b/cmd/provider/logging/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/memcache/zz_main.go b/cmd/provider/memcache/zz_main.go index 07c48942f..13a1859c7 100644 --- a/cmd/provider/memcache/zz_main.go +++ b/cmd/provider/memcache/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/mlengine/zz_main.go b/cmd/provider/mlengine/zz_main.go index 33e25206e..36467ea2b 100644 --- a/cmd/provider/mlengine/zz_main.go +++ b/cmd/provider/mlengine/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/monitoring/zz_main.go b/cmd/provider/monitoring/zz_main.go index fb75bc884..8a9e664a9 100644 --- a/cmd/provider/monitoring/zz_main.go +++ b/cmd/provider/monitoring/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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 99e42029e..335e2a27c 100644 --- a/cmd/provider/monolith/zz_main.go +++ b/cmd/provider/monolith/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/networkconnectivity/zz_main.go b/cmd/provider/networkconnectivity/zz_main.go index 51ed97da5..3610493f4 100644 --- a/cmd/provider/networkconnectivity/zz_main.go +++ b/cmd/provider/networkconnectivity/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/networkmanagement/zz_main.go b/cmd/provider/networkmanagement/zz_main.go index f33b8ffb2..0b54d7f32 100644 --- a/cmd/provider/networkmanagement/zz_main.go +++ b/cmd/provider/networkmanagement/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/notebooks/zz_main.go b/cmd/provider/notebooks/zz_main.go index 4935e6b87..7c5cd40a9 100644 --- a/cmd/provider/notebooks/zz_main.go +++ b/cmd/provider/notebooks/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/osconfig/zz_main.go b/cmd/provider/osconfig/zz_main.go index de1827f03..c3b065c05 100644 --- a/cmd/provider/osconfig/zz_main.go +++ b/cmd/provider/osconfig/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/oslogin/zz_main.go b/cmd/provider/oslogin/zz_main.go index 1af7d3a41..fbd69219f 100644 --- a/cmd/provider/oslogin/zz_main.go +++ b/cmd/provider/oslogin/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/privateca/zz_main.go b/cmd/provider/privateca/zz_main.go index c948259fa..ee7a7383f 100644 --- a/cmd/provider/privateca/zz_main.go +++ b/cmd/provider/privateca/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/pubsub/zz_main.go b/cmd/provider/pubsub/zz_main.go index 9deed02da..538cba4f5 100644 --- a/cmd/provider/pubsub/zz_main.go +++ b/cmd/provider/pubsub/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/redis/zz_main.go b/cmd/provider/redis/zz_main.go index 285b1e288..38e5a429a 100644 --- a/cmd/provider/redis/zz_main.go +++ b/cmd/provider/redis/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/secretmanager/zz_main.go b/cmd/provider/secretmanager/zz_main.go index 1a9537cf8..c5328200d 100644 --- a/cmd/provider/secretmanager/zz_main.go +++ b/cmd/provider/secretmanager/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/servicenetworking/zz_main.go b/cmd/provider/servicenetworking/zz_main.go index 810a51268..3a212af55 100644 --- a/cmd/provider/servicenetworking/zz_main.go +++ b/cmd/provider/servicenetworking/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/sourcerepo/zz_main.go b/cmd/provider/sourcerepo/zz_main.go index 8e8d8b9b2..bc13d355f 100644 --- a/cmd/provider/sourcerepo/zz_main.go +++ b/cmd/provider/sourcerepo/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/spanner/zz_main.go b/cmd/provider/spanner/zz_main.go index 1bc5c6773..3284322b4 100644 --- a/cmd/provider/spanner/zz_main.go +++ b/cmd/provider/spanner/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/sql/zz_main.go b/cmd/provider/sql/zz_main.go index 7b8973230..c5c88d5f5 100644 --- a/cmd/provider/sql/zz_main.go +++ b/cmd/provider/sql/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/storage/zz_main.go b/cmd/provider/storage/zz_main.go index d199d3345..eb0e6bb03 100644 --- a/cmd/provider/storage/zz_main.go +++ b/cmd/provider/storage/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/storagetransfer/zz_main.go b/cmd/provider/storagetransfer/zz_main.go index bacfae24e..d177a1aa5 100644 --- a/cmd/provider/storagetransfer/zz_main.go +++ b/cmd/provider/storagetransfer/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/tpu/zz_main.go b/cmd/provider/tpu/zz_main.go index c2b3aef87..f4beec717 100644 --- a/cmd/provider/tpu/zz_main.go +++ b/cmd/provider/tpu/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/vertexai/zz_main.go b/cmd/provider/vertexai/zz_main.go index 825df820f..1236952c7 100644 --- a/cmd/provider/vertexai/zz_main.go +++ b/cmd/provider/vertexai/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/vpcaccess/zz_main.go b/cmd/provider/vpcaccess/zz_main.go index bd041a771..e4d656290 100644 --- a/cmd/provider/vpcaccess/zz_main.go +++ b/cmd/provider/vpcaccess/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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/workflows/zz_main.go b/cmd/provider/workflows/zz_main.go index 2db0db58e..b18e63f77 100644 --- a/cmd/provider/workflows/zz_main.go +++ b/cmd/provider/workflows/zz_main.go @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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 b0cc7be41..e27c72d36 100644 --- a/hack/main.go.tmpl +++ b/hack/main.go.tmpl @@ -19,6 +19,8 @@ package main import ( "context" "fmt" + "io" + "log" "os" "path/filepath" "time" @@ -79,9 +81,11 @@ func main() { ) 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-gcp")) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) 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 @@ -91,7 +95,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() @@ -115,7 +119,7 @@ func main() { kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ - Logger: log, + Logger: logr, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), PollInterval: *pollInterval, MaxConcurrentReconciles: *maxReconcileRate, @@ -124,21 +128,21 @@ func main() { Provider: provider, SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), PollJitter: pollJitter, - OperationTrackerStore: tjcontroller.NewOperationStore(log), + OperationTrackerStore: tjcontroller.NewOperationStore(logr), } 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.")