Skip to content

Commit

Permalink
Reload networks if none is found
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Paul Holzinger committed Feb 20, 2021
1 parent fec15d9 commit cd5167f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/ocicni/ocicni.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit cd5167f

Please sign in to comment.