Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/ocicni/ocicni.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,22 @@ func (network *cniNetwork) deleteFromNetwork(cacheDir string, podNetwork *PodNet
}

netconf, cninet := network.NetworkConfig, network.CNIConfig

// use cache if exist
cachedBytes, cachedRuntime, err := cninet.GetNetworkListCachedConfig(network.NetworkConfig, rt)
if err == nil {
cachedNetworkConfigList, err := libcni.ConfListFromBytes(cachedBytes)
if err == nil {
logrus.Infof("About to del CNI network %s with cahce (type=%v)", netconf.Name, netconf.Plugins[0].Network.Type)
err = cninet.DelNetworkList(context.Background(), cachedNetworkConfigList, cachedRuntime)
if err != nil {
logrus.Errorf("Error deleting network with cache: %v", err)
return err
}
return nil
}
}

logrus.Infof("About to del CNI network %s (type=%v)", netconf.Name, netconf.Plugins[0].Network.Type)
err = cninet.DelNetworkList(context.Background(), netconf, rt)
if err != nil {
Expand Down