Skip to content

Commit c3a4cf6

Browse files
committed
fix: set a default controller runtime log
See siderolabs/cluster-api-bootstrap-provider-talos#185 Signed-off-by: Andrey Smirnov <[email protected]>
1 parent 1f0ef42 commit c3a4cf6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
2323
"k8s.io/component-base/logs"
2424
logsv1 "k8s.io/component-base/logs/api/v1"
25+
"k8s.io/klog/v2"
2526
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2627
"sigs.k8s.io/cluster-api/controllers/remote"
2728
"sigs.k8s.io/cluster-api/util/flags"
@@ -82,6 +83,9 @@ func main() {
8283
os.Exit(1)
8384
}
8485

86+
// klog.Background will automatically use the right logger.
87+
ctrl.SetLogger(klog.Background())
88+
8589
diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)
8690

8791
tlsOptionOverrides, err := flags.GetTLSOptionOverrideFuncs(tlsOptions)

0 commit comments

Comments
 (0)