-
Notifications
You must be signed in to change notification settings - Fork 255
ensure controller runtime uses logrus for logging #1263
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
ensure controller runtime uses logrus for logging #1263
Conversation
controller runtime currently defaults to NullLogger [1] which doesn't log anything. This is bad because any error returned from Reconcile function is therefore not logged anywhere which is same as just eating the error. To make sure the controller runtime errors are also logged we would need an adapter for logrus as this project uses that for logging. Therefore, this implements a wrapper around lorgus that satisfies the logr.Logger interface and confure the hive-controller and hive-operator managers with it. The wrapper uses logrus.DebugLevel for all info messages and logrus.ErrorLevel for all error messages from controller-runtime regardless of level (V) selected by caller in controller-runtime. This makes sure all error messages from controller-runtime are always visible and the rest are only visible when in debug mode. [1]: https://github.com/kubernetes-sigs/controller-runtime/blob/9e78e653228851684b6b9cdabe5aae8559fe3722/pkg/log/null.go#L28
dea7271 to
611cbb8
Compare
|
This is terrific, thanks! /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, dgoodwin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick ocm-2.2 |
|
/cherry-pick ocm-2.1 |
|
@abhinavdahiya: new pull request created: #1265 DetailsIn response to this:
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. |
|
@abhinavdahiya: new pull request created: #1266 DetailsIn response to this:
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. |
controller runtime currently defaults to NullLogger 1 which doesn't log anything.
This is bad because any error returned from Reconcile function is therefore not logged anywhere
which is same as just eating the error. To make sure the controller runtime errors are also logged
we would need an adapter for logrus as this project uses that for logging.
Therefore, this implements a wrapper around lorgus that satisfies the logr.Logger interface and
confure the hive-controller and hive-operator managers with it.
The wrapper uses logrus.DebugLevel for all info messages and logrus.ErrorLevel for all error messages
from controller-runtime regardless of level (V) selected by caller in controller-runtime. This makes
sure all error messages from controller-runtime are always visible and the rest are only visible when in
debug mode.
/assign @dgoodwin
/cc @joelddiaz