Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set log.Default's output to io.Discard #1215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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
go-version: "1.21"
cleanup-disk: true
secrets:
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_COMMUNITY_BOT_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/native-provider-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/aws
go-version: 1.21
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish-service-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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 }}
Expand All @@ -39,6 +39,7 @@ jobs:
branch_name: ${{ github.event.inputs.branch_name }}
version: ${{ github.event.inputs.version }}
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/updoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 14 additions & 10 deletions cmd/provider/accessanalyzer/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package main

import (
"context"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -57,9 +59,11 @@ func main() {
setupConfig.NativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String()

kingpin.MustParse(app.Parse(os.Args[1:]))
log.Default().SetOutput(io.Discard)
ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard)))

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-aws"))
logr := logging.NewLogrLogger(zl.WithName("provider-aws"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
Expand All @@ -69,7 +73,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()
Expand All @@ -96,7 +100,7 @@ func main() {
// This removes some complexity for setting up development environments.
setupConfig.DefaultScheduler = terraform.NewNoOpProviderScheduler()
if len(*setupConfig.NativeProviderPath) != 0 {
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL,
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(logr, *pluginProcessTTL,
terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*setupConfig.NativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*setupConfig.NativeProviderSource)))
}

Expand All @@ -107,32 +111,32 @@ func main() {
setupConfig.AWSClient = awsClient
o := tjcontroller.Options{
Options: xpcontroller.Options{
Logger: log,
Logger: logr,
GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate),
PollInterval: *pollInterval,
MaxConcurrentReconciles: *maxReconcileRate,
Features: &feature.Flags{},
},
Provider: provider,
SetupFn: clients.SelectTerraformSetup(log, setupConfig),
SetupFn: clients.SelectTerraformSetup(logr, setupConfig),
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)
}

o.WorkspaceStore = terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))
o.WorkspaceStore = terraform.NewWorkspaceStore(logr, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))

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.")

Expand Down
24 changes: 14 additions & 10 deletions cmd/provider/account/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package main

import (
"context"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -57,9 +59,11 @@ func main() {
setupConfig.NativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String()

kingpin.MustParse(app.Parse(os.Args[1:]))
log.Default().SetOutput(io.Discard)
ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard)))

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-aws"))
logr := logging.NewLogrLogger(zl.WithName("provider-aws"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
Expand All @@ -69,7 +73,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()
Expand All @@ -96,7 +100,7 @@ func main() {
// This removes some complexity for setting up development environments.
setupConfig.DefaultScheduler = terraform.NewNoOpProviderScheduler()
if len(*setupConfig.NativeProviderPath) != 0 {
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL,
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(logr, *pluginProcessTTL,
terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*setupConfig.NativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*setupConfig.NativeProviderSource)))
}

Expand All @@ -107,32 +111,32 @@ func main() {
setupConfig.AWSClient = awsClient
o := tjcontroller.Options{
Options: xpcontroller.Options{
Logger: log,
Logger: logr,
GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate),
PollInterval: *pollInterval,
MaxConcurrentReconciles: *maxReconcileRate,
Features: &feature.Flags{},
},
Provider: provider,
SetupFn: clients.SelectTerraformSetup(log, setupConfig),
SetupFn: clients.SelectTerraformSetup(logr, setupConfig),
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)
}

o.WorkspaceStore = terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))
o.WorkspaceStore = terraform.NewWorkspaceStore(logr, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))

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.")

Expand Down
24 changes: 14 additions & 10 deletions cmd/provider/acm/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package main

import (
"context"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -57,9 +59,11 @@ func main() {
setupConfig.NativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String()

kingpin.MustParse(app.Parse(os.Args[1:]))
log.Default().SetOutput(io.Discard)
ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard)))

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-aws"))
logr := logging.NewLogrLogger(zl.WithName("provider-aws"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
Expand All @@ -69,7 +73,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()
Expand All @@ -96,7 +100,7 @@ func main() {
// This removes some complexity for setting up development environments.
setupConfig.DefaultScheduler = terraform.NewNoOpProviderScheduler()
if len(*setupConfig.NativeProviderPath) != 0 {
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL,
setupConfig.DefaultScheduler = terraform.NewSharedProviderScheduler(logr, *pluginProcessTTL,
terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*setupConfig.NativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*setupConfig.NativeProviderSource)))
}

Expand All @@ -107,32 +111,32 @@ func main() {
setupConfig.AWSClient = awsClient
o := tjcontroller.Options{
Options: xpcontroller.Options{
Logger: log,
Logger: logr,
GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate),
PollInterval: *pollInterval,
MaxConcurrentReconciles: *maxReconcileRate,
Features: &feature.Flags{},
},
Provider: provider,
SetupFn: clients.SelectTerraformSetup(log, setupConfig),
SetupFn: clients.SelectTerraformSetup(logr, setupConfig),
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)
}

o.WorkspaceStore = terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))
o.WorkspaceStore = terraform.NewWorkspaceStore(logr, terraform.WithDisableInit(len(*setupConfig.NativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval), terraform.WithFeatures(o.Features))

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.")

Expand Down
Loading
Loading