From cd5167ffe95976c7b50ecc99ace7cae1713eb8ae Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Sat, 20 Feb 2021 15:05:16 +0100 Subject: [PATCH] Reload networks if none is found In the podman CI tests are consistently flaking with CNI network not found ... I think the problem is that ocicni updates based on fsnotify and this can be slower than the podman calls. As a solution the networks should be synced if no match is found. If it is still not found afterwards return the network not found error. Signed-off-by: Paul Holzinger --- pkg/ocicni/ocicni.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/ocicni/ocicni.go b/pkg/ocicni/ocicni.go index 1f8d3116..28cc8802 100644 --- a/pkg/ocicni/ocicni.go +++ b/pkg/ocicni/ocicni.go @@ -495,8 +495,15 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache if cniNet == nil { cniNet, err = plugin.getNetwork(network.Name) if err != nil { - logrus.Errorf(err.Error()) - return err + // try to load the networks again + if err2 := plugin.syncNetworkConfig(); err2 != nil { + logrus.Error(err2) + return err + } + cniNet, err = plugin.getNetwork(network.Name) + if err != nil { + return err + } } }