mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-07-31 07:32:09 +00:00
The cachefile name should be the delegate configuration name (#841)
It was previously using the net-attach-def name, which doesn't align with the cache file. Causing default-route selection to not succeed.
This commit is contained in:
parent
ecc1482d50
commit
dcbc215b93
@ -617,14 +617,14 @@ func CmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) (c
|
||||
}
|
||||
}
|
||||
|
||||
netName := ""
|
||||
// We collect the delegate netName for the cachefile name as well as following errors
|
||||
netName := delegate.Conf.Name
|
||||
if netName == "" {
|
||||
netName = delegate.ConfList.Name
|
||||
}
|
||||
tmpResult, err = delegateAdd(exec, kubeClient, pod, delegate, rt, n)
|
||||
if err != nil {
|
||||
// If the add failed, tear down all networks we already added
|
||||
netName = delegate.Conf.Name
|
||||
if netName == "" {
|
||||
netName = delegate.ConfList.Name
|
||||
}
|
||||
// Ignore errors; DEL must be idempotent anyway
|
||||
_ = delPlugins(exec, nil, args, k8sArgs, n.Delegates, idx, n.RuntimeConfig, n)
|
||||
return nil, cmdPluginErr(k8sArgs, netName, "error adding container to network %q: %v", netName, err)
|
||||
@ -666,10 +666,6 @@ func CmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) (c
|
||||
}
|
||||
}
|
||||
|
||||
// Remove namespace from delegate.Name for Add/Del CNI cache
|
||||
nameSlice := strings.Split(delegate.Name, "/")
|
||||
netName = nameSlice[len(nameSlice)-1]
|
||||
|
||||
// Remove gateway if `default-route` network selection is specified
|
||||
if deleteV4gateway || deleteV6gateway {
|
||||
err = netutils.DeleteDefaultGW(args, ifName)
|
||||
|
Loading…
Reference in New Issue
Block a user