Skip to content

Commit 3486b5c

Browse files
Merge pull request #389 from jcpowermac/fix-sync-logging
OCPBUGS-56508: Fix config-sync-controller logging
2 parents 7ddcbe3 + de9dd4d commit 3486b5c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cmd/config-sync-controllers/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"time"
2323

2424
"github.com/spf13/pflag"
25+
"k8s.io/klog/v2"
2526

2627
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
2728
// to ensure that exec-entrypoint and run can make use of them.
@@ -32,7 +33,6 @@ import (
3233
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3334
"k8s.io/component-base/config"
3435
"k8s.io/component-base/config/options"
35-
"k8s.io/klog/v2/textlogger"
3636
"k8s.io/utils/clock"
3737
ctrl "sigs.k8s.io/controller-runtime"
3838
"sigs.k8s.io/controller-runtime/pkg/cache"
@@ -65,8 +65,7 @@ func init() {
6565
}
6666

6767
func main() {
68-
textLoggerCfg := textlogger.NewConfig()
69-
textLoggerCfg.AddFlags(flag.CommandLine)
68+
klog.InitFlags(flag.CommandLine)
7069

7170
healthAddr := flag.String(
7271
"health-addr",
@@ -86,7 +85,7 @@ func main() {
8685
options.BindLeaderElectionFlags(&leaderElectionConfig, pflag.CommandLine)
8786
pflag.Parse()
8887

89-
ctrl.SetLogger(textlogger.NewLogger(textLoggerCfg).WithName("CCCMOConfigSyncControllers"))
88+
ctrl.SetLogger(klog.NewKlogr().WithName("CCCMOConfigSyncControllers"))
9089

9190
restConfig := ctrl.GetConfigOrDie()
9291
le := util.GetLeaderElectionDefaults(restConfig, configv1.LeaderElection{

0 commit comments

Comments
 (0)