Skip to content

Commit

Permalink
Merge pull request #482 from ulucinar/release-0.41-fix-logs
Browse files Browse the repository at this point in the history
Set log.Default's output to io.Discard
  • Loading branch information
ulucinar authored Mar 14, 2024
2 parents fbf8449 + 5372ed6 commit 06973d5
Show file tree
Hide file tree
Showing 86 changed files with 829 additions and 529 deletions.
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
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.yml
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_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/google
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 @@ -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 }}
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build
18 changes: 11 additions & 7 deletions cmd/provider/accesscontextmanager/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package main
import (
"context"
"fmt"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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,
Expand All @@ -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.")

Expand Down
18 changes: 11 additions & 7 deletions cmd/provider/activedirectory/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package main
import (
"context"
"fmt"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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,
Expand All @@ -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.")

Expand Down
18 changes: 11 additions & 7 deletions cmd/provider/alloydb/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package main
import (
"context"
"fmt"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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,
Expand All @@ -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.")

Expand Down
18 changes: 11 additions & 7 deletions cmd/provider/apigee/zz_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package main
import (
"context"
"fmt"
"io"
"log"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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,
Expand All @@ -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.")

Expand Down
Loading

0 comments on commit 06973d5

Please sign in to comment.