Skip to content

Commit

Permalink
fix: set a default controller runtime log
Browse files Browse the repository at this point in the history
  • Loading branch information
smira committed Jan 22, 2024
1 parent aabe7bc commit 30d077f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/caps-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
cgrecord "k8s.io/client-go/tools/record"
"k8s.io/component-base/logs"
logsv1 "k8s.io/component-base/logs/api/v1"
"k8s.io/klog/v2"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/remote"
"sigs.k8s.io/cluster-api/util/flags"
Expand Down Expand Up @@ -89,6 +90,9 @@ func main() {
os.Exit(1)
}

// klog.Background will automatically use the right logger.
ctrl.SetLogger(klog.Background())

diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)

tlsOptionOverrides, err := flags.GetTLSOptionOverrideFuncs(tlsOptions)
Expand Down
4 changes: 4 additions & 0 deletions app/sidero-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/component-base/logs"
logsv1 "k8s.io/component-base/logs/api/v1"
"k8s.io/klog/v2"
capi "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/flags"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -137,6 +138,9 @@ func main() {
os.Exit(1)
}

// klog.Background will automatically use the right logger.
ctrl.SetLogger(klog.Background())

diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)

tlsOptionOverrides, err := flags.GetTLSOptionOverrideFuncs(tlsOptions)
Expand Down

0 comments on commit 30d077f

Please sign in to comment.