Skip to content

[release-4.19] OCPBUGS-56788: Fix config-sync-controller logging #390

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

Open
wants to merge 1 commit into
base: release-4.19
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions cmd/config-sync-controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

"github.com/spf13/pflag"
"k8s.io/klog/v2"

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

func main() {
textLoggerCfg := textlogger.NewConfig()
textLoggerCfg.AddFlags(flag.CommandLine)
klog.InitFlags(flag.CommandLine)

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

ctrl.SetLogger(textlogger.NewLogger(textLoggerCfg).WithName("CCCMOConfigSyncControllers"))
ctrl.SetLogger(klog.NewKlogr().WithName("CCCMOConfigSyncControllers"))

restConfig := ctrl.GetConfigOrDie()
le := util.GetLeaderElectionDefaults(restConfig, configv1.LeaderElection{
Expand Down