-
Notifications
You must be signed in to change notification settings - Fork 55
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
Log events only related to a valid CNI configuration file. #232
base: master
Are you sure you want to change the base?
Log events only related to a valid CNI configuration file. #232
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: roman-kiselenko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pull Request Test Coverage Report for Build 11762983317Details
💛 - Coveralls |
910bb50
to
0cfe056
Compare
Logs only .conf, .json and .conflist files. Signed-off-by: roman-kiselenko <[email protected]>
0cfe056
to
b661a2b
Compare
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.
Thank you! I have a suggestion, otherwise LGTM
exts := map[string]bool{} | ||
for _, ext := range []string{".conf", ".conflist", ".json"} { | ||
exts[ext] = true | ||
} | ||
for { | ||
select { | ||
case event := <-plugin.watcher.Events: | ||
logrus.Infof("CNI monitoring event %v", event) | ||
if exts[filepath.Ext(event.Name)] { | ||
logrus.Infof("CNI monitoring event %v", event) | ||
} |
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 about avoiding the map:
exts := []string{".conf", ".conflist", ".json"}
for {
select {
case event := <-plugin.watcher.Events:
if slices.Contains(exts, filepath.Ext(event.Name)) {
logrus.Infof("CNI monitoring event %v", event)
}
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 it, I will change it.
Logs only
.conf
,.json
and.conflist
files.Context #208 (comment)
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Reduce noisy log messages
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Some additional context is here.
Does this PR introduce a user-facing change?
@kwilczynski @saschagrunert PTAL