Check ConfList in delete network by cache

This change adds ConfList check in get delegates from cache,
to delete network gracefully.
This commit is contained in:
Tomofumi Hayashi
2019-03-29 21:31:49 +09:00
committed by Tomofumi Hayashi
parent 69ac1a5935
commit f11c851d97

View File

@@ -479,6 +479,12 @@ func cmdDel(args *skel.CmdArgs, exec invoke.Exec, kubeClient k8s.KubeClient) err
if err := json.Unmarshal(netconfBytes, &in.Delegates); err != nil { if err := json.Unmarshal(netconfBytes, &in.Delegates); err != nil {
return logging.Errorf("Multus: failed to load netconf: %v", err) return logging.Errorf("Multus: failed to load netconf: %v", err)
} }
// check plugins field and enable ConfListPlugin if there is
for _, v := range in.Delegates {
if len(v.ConfList.Plugins) != 0 {
v.ConfListPlugin = true
}
}
// First delegate is always the master plugin // First delegate is always the master plugin
in.Delegates[0].MasterPlugin = true in.Delegates[0].MasterPlugin = true
} }