-
Notifications
You must be signed in to change notification settings - Fork 1.2k
✨ Add options to configure a logger for manager and controllers #1095
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
✨ Add options to configure a logger for manager and controllers #1095
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
64221d9
to
c8755c5
Compare
pkg/builder/controller.go
Outdated
if ctrlOptions.Log == nil { | ||
ctrlOptions.Log = blder.mgr.GetLogger() | ||
} | ||
ctrlOptions.Log = ctrlOptions.Log.WithValues("groupVersionKind", gvk.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we properly distinguish this from what we do in the encoder
enc.AddString("apiVersion", gvk.GroupVersion().String()) |
I think the log key should maybe be reoncilerGroupVersionKind
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the logging here should remove the need to enrich the log entries in the zap helper. Would you expect any delta between the gvk defined here and the resource passed to reconcile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its totally possible that during the reconciliation of an object type a an object type b has to be updated and that fails so I think the two are complementary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, used reconcilerGroup
and reconcilerKind
pkg/builder/controller.go
Outdated
if ctrlOptions.Log == nil { | ||
ctrlOptions.Log = blder.mgr.GetLogger() | ||
} | ||
ctrlOptions.Log = ctrlOptions.Log.WithValues("groupVersionKind", gvk.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the logging here should remove the need to enrich the log entries in the zap helper. Would you expect any delta between the gvk defined here and the resource passed to reconcile?
Signed-off-by: Vince Prignano <[email protected]>
c8755c5
to
829c816
Compare
@vincepri: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/lgtm |
Signed-off-by: Vince Prignano [email protected]
/assign @alvaroaleman @detiber
Made these changes also backward compatible to be able to go in v0.6.2