From b480336dd79543f08b014c8bde597cf151a5d996 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 9 Jun 2017 10:19:26 +0200 Subject: [PATCH] ocicni: Handle create and write events By only handling create events, we are breaking plugins that don't create and write atomically, like weave for example. The Weave plugin creates the file first and later write to it. We are missing the second part and never see the final CNI config file. Signed-off-by: Samuel Ortiz --- pkg/ocicni/ocicni.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/ocicni/ocicni.go b/pkg/ocicni/ocicni.go index 3b2ed8be..0a0e1740 100644 --- a/pkg/ocicni/ocicni.go +++ b/pkg/ocicni/ocicni.go @@ -48,7 +48,8 @@ func (plugin *cniNetworkPlugin) monitorNetDir() { select { case event := <-watcher.Events: logrus.Debugf("CNI monitoring event %v", event) - if event.Op&fsnotify.Create != fsnotify.Create { + if event.Op&fsnotify.Create != fsnotify.Create && + event.Op&fsnotify.Write != fsnotify.Write { continue }