Skip to content
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

🌱 Set controller-runtime logger for clusterctl #9107

Merged
merged 1 commit into from
Aug 7, 2023
Merged
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
5 changes: 4 additions & 1 deletion cmd/clusterctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
kubectlcmd "k8s.io/kubectl/pkg/cmd"
ctrl "sigs.k8s.io/controller-runtime"

"sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log"
Expand Down Expand Up @@ -163,7 +164,9 @@ func initConfig() {
}
}

logf.SetLogger(logf.NewLogger(logf.WithThreshold(verbosity)))
log := logf.NewLogger(logf.WithThreshold(verbosity))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! (de-encapsulate to encapsulate it again later :))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just extracted the statement we had before :) (didn't really think about it)

logf.SetLogger(log)
ctrl.SetLogger(log)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! the checks are working 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately missed it until after the release :) But yup worked.

I wonder in how many binaries / controllers this "panic" will pop up :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but it's doing what it's supposed to do 😄

}

func registerCompletionFuncForCommonFlags() {
Expand Down