Skip to content

Commit

Permalink
Log events only related to a valid CNI configuration file.
Browse files Browse the repository at this point in the history
Logs only .conf, .json and .conflist files.

Signed-off-by: roman-kiselenko <[email protected]>
  • Loading branch information
roman-kiselenko committed Nov 10, 2024
1 parent 94d9529 commit b661a2b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/ocicni/ocicni.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,16 @@ func (plugin *cniNetworkPlugin) monitorConfDir(ctx context.Context, start *sync.
start.Done()
plugin.done.Add(1)
defer plugin.done.Done()
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)
}

var defaultDeleted bool
createWriteRename := event.Op&fsnotify.Create == fsnotify.Create ||
Expand Down

0 comments on commit b661a2b

Please sign in to comment.