-
Notifications
You must be signed in to change notification settings - Fork 363
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
Support get/set log verbosity level by antctl and controller/agent API #1340
Conversation
Thanks for your PR. The following commands are available:
|
I feel very useful to allow changing log level in the runtime. |
Codecov Report
@@ Coverage Diff @@
## master #1340 +/- ##
==========================================
- Coverage 64.63% 64.47% -0.17%
==========================================
Files 157 159 +2
Lines 12626 12657 +31
==========================================
- Hits 8161 8160 -1
- Misses 3620 3645 +25
- Partials 845 852 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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, I think we should mention the command in the antctl documentation (with the limitation that it only supports local execution).
pkg/log/log_level.go
Outdated
if err != nil { | ||
return err | ||
} | ||
klog.Infof("Change log level from %s to %s", oldLevel, level) |
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.
nit: "Changed" or "Changing"
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.
Changed to "Changed"
build/yamls/base/antctl.yml
Outdated
@@ -50,6 +50,7 @@ rules: | |||
verbs: | |||
- get | |||
- nonResourceURLs: | |||
- /loglevel |
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 thought these were kept in alphabetical order on purpose?
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.
Ok. Changed.
"github.com/vmware-tanzu/antrea/pkg/log" | ||
) | ||
|
||
// HandleFunc returns the function which can handle the /log-level API request. |
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.
You used /loglevel
for the APIU endpoint
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 like to follow the kubectl (and other antctl commands) style which use "-" to connect two words in command names, like cluster-info, port-forward, api-resources.
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 undertand and I'm not suggesting you changed the antctl command name. But you are referring to the API endpoint here, for which you used /loglevel
not /log-level
.
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 see. I think we want not connectors in API path?
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.
We haven't been using them so far, so I was really just suggesting fixing the comment
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.
Ok. Sorry for being misunderstanding your comments.
Changed to /loglevel.
f14e3c0
to
8f5766b
Compare
Added the command to antctl.md. |
Add antctl log-level command that calls controller or agent /loglevel API to get/set the log verbosity level of controller or agent in the runtime. Change antctl to allow an empty response of an controller or agent call.
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
/test-all |
Add antctl log-level command that calls controller or agent /loglevel
API to get/set the log verbosity level of controller or agent in the
runtime.
Change antctl to allow an empty response of an controller or agent
call.