diff --git a/bootstrap/kubeadm/main.go b/bootstrap/kubeadm/main.go index 115aec01272a..4305c03b33a6 100644 --- a/bootstrap/kubeadm/main.go +++ b/bootstrap/kubeadm/main.go @@ -34,6 +34,7 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" cliflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/logs" + logapiv1 "k8s.io/component-base/logs/api/v1" _ "k8s.io/component-base/logs/json/register" "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" @@ -89,7 +90,7 @@ var ( // InitFlags initializes this manager's flags. func InitFlags(fs *pflag.FlagSet) { logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags()) - logOptions.AddFlags(fs) + logapiv1.AddFlags(logOptions, fs) fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080", "The address the metric endpoint binds to.") @@ -144,7 +145,7 @@ func main() { pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() - if err := logOptions.ValidateAndApply(nil); err != nil { + if err := logapiv1.ValidateAndApply(logOptions, nil); err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) } diff --git a/controlplane/kubeadm/main.go b/controlplane/kubeadm/main.go index 79263ec41edf..44a55a68b67a 100644 --- a/controlplane/kubeadm/main.go +++ b/controlplane/kubeadm/main.go @@ -36,6 +36,7 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" cliflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/logs" + logapiv1 "k8s.io/component-base/logs/api/v1" _ "k8s.io/component-base/logs/json/register" "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" @@ -93,7 +94,7 @@ var ( // InitFlags initializes the flags. func InitFlags(fs *pflag.FlagSet) { logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags()) - logOptions.AddFlags(fs) + logapiv1.AddFlags(logOptions, fs) fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080", "The address the metric endpoint binds to.") @@ -147,7 +148,7 @@ func main() { pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() - if err := logOptions.ValidateAndApply(nil); err != nil { + if err := logapiv1.ValidateAndApply(logOptions, nil); err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) } diff --git a/main.go b/main.go index 2445aef8d164..a3c0aa87ed69 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,7 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" cliflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/logs" + logapiv1 "k8s.io/component-base/logs/api/v1" _ "k8s.io/component-base/logs/json/register" "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" @@ -128,7 +129,7 @@ func init() { // InitFlags initializes the flags. func InitFlags(fs *pflag.FlagSet) { logs.AddFlags(fs, logs.SkipLoggingConfigurationFlags()) - logOptions.AddFlags(fs) + logapiv1.AddFlags(logOptions, fs) fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080", "The address the metric endpoint binds to.") @@ -207,7 +208,7 @@ func main() { pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() - if err := logOptions.ValidateAndApply(nil); err != nil { + if err := logapiv1.ValidateAndApply(logOptions, nil); err != nil { setupLog.Error(err, "unable to start manager") os.Exit(1) }