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

Minor cleanup of the webhook #2886

Merged
merged 2 commits into from
Jan 23, 2019
Merged

Conversation

dgerd
Copy link

@dgerd dgerd commented Jan 10, 2019

Fixes some logging messages, comments, and error handling.

@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 10, 2019
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a 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.

Copy link
Contributor

@vagababov vagababov left a 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 💯

cmd/webhook/main.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2019
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2019
@dgerd
Copy link
Author

dgerd commented Jan 10, 2019

/test pull-knative-serving-integration-tests

@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2019
Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/hold
/approve

@@ -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))
Copy link
Member

Choose a reason for hiding this comment

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

Should this be Fatalw?

Copy link
Author

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":""}

Copy link
Member

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?

Copy link
Author

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.

cmd/webhook/main.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 14, 2019
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2019
@dgerd
Copy link
Author

dgerd commented Jan 15, 2019

/test pull-knative-serving-integration-tests

@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2019
Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@evankanderson
Copy link
Member

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 22, 2019
@knative-prow-robot knative-prow-robot merged commit b49fc14 into knative:master Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants