:sparkles: Use `klog` as the controller-runtime default logger
Fixes https://github.com/kubernetes-sigs/kubebuilder/issues/3018
To make the log output consistent with K8s core components (kube-apiserver, kube-controller-manager, etc), and more human readable.
Test results: Before this PR, the kubebuilder generated controller-manager log is:
1.6656692709539523e+09 INFO controller-runtime.metrics Metrics server is starting to listen {"addr": "127.0.0.1:8080"}
1.665669270954326e+09 INFO setup starting manager
1.6656692709546785e+09 INFO Starting server {"path": "/metrics", "kind": "metrics", "addr": "127.0.0.1:8080"}
1.6656692709546802e+09 INFO Starting server {"kind": "health probe", "addr": "[::]:8081"}
After this PR, the kubebuilder generated controller-manager log is:
I1016 23:41:42.700531 61722 listener.go:44] "controller-runtime/metrics: Metrics server is starting to listen" addr=":8080"
I1016 23:41:42.701073 61722 main.go:115] "setup: starting manager"
I1016 23:41:42.701251 61722 internal.go:362] "Starting server" kind="health probe" addr="[::]:8081"
I1016 23:41:42.701255 61722 internal.go:362] "Starting server" path="/metrics" kind="metrics" addr="[::]:8080"
Welcome @astraw99!
It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @astraw99. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: astraw99
Once this PR has been reviewed and has the lgtm label, please assign shawn-hurley for approval by writing /assign @shawn-hurley in a comment. For more information see:The Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/ok-to-test
I prefer klog, but not sure if it is ok for compatibility. And this PR needs to be marked as breaking since we change the default logger.
C-R intentionally uses an interface that you can put whatever logger implementation you like most into, so I don't think we want to merge this.