Skip to content

Commit

Permalink
Fix breaking changes introduced in v1.25
Browse files Browse the repository at this point in the history
All log config methods became functions in v1.25:
kubernetes/component-base@41262c3
  • Loading branch information
Fedosin committed Aug 25, 2022
1 parent 1001829 commit 0134d91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 0134d91

Please sign in to comment.