-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Minor cleanup of the webhook #2886
Conversation
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.
@dgerd: 0 warnings.
In response to this:
Fixes some logging messages, comments, and error handling.
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.
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.
/lgtm
love the comment change 💯
/test pull-knative-serving-integration-tests |
/lgtm |
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.
/hold
/approve
cmd/webhook/main.go
Outdated
@@ -79,7 +79,7 @@ func main() { | |||
configMapWatcher := configmap.NewInformedWatcher(kubeClient, system.Namespace) | |||
configMapWatcher.Watch(logging.ConfigName, logging.UpdateLevelFromConfigMap(logger, atomicLevel, component)) | |||
if err = configMapWatcher.Start(stopCh); err != nil { | |||
logger.Fatalf("failed to start configuration manager: %v", err) | |||
logger.Fatal("Failed to start the ConfigMap watcher", zap.Error(err)) |
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.
Should this be Fatalw
?
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.
I am still new using Zap; however, my understanding is that we don't need Fatalw as err is surrounded in zap.Error() which creates the key/value structure for us. The equivalent if we were using Fatalw would be:
logger.Fatalw("Failed to start the ConfigMap wacher",
"error", err)
The output for either should look like:
{"level":"error", "msg":"Failed to start the ConfigMap watcher", "error":""}
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.
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
Sprint formats using the default formats for its operands and returns the resulting string. Spaces are added between operands when neither is a string.
So I think this would produce:
{"level":"error", "msg":"Failed to start the ConfigMap watcher {"error": ""}"}
You may be right on the keys and values separate.
Have you been able to test the output here?
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.
So went back and tested the output and you are correct here. The example in the documentation ( https://godoc.org/go.uber.org/zap ) was a bit misleading.
It looks like we have this same mistake in other parts of the code such as in activator. I have made the fix here. I will make a new PR to fix the other locations.
/test pull-knative-serving-integration-tests |
/lgtm |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgerd, evankanderson 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 |
/hold cancel |
Fixes some logging messages, comments, and error handling.