mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-06-29 09:07:00 +00:00
fixing multus runtime error for network status without pod network annotation
This commit is contained in:
parent
02255b40fa
commit
d71fe3447f
@ -380,7 +380,8 @@ func TryLoadK8sDelegates(k8sArgs *types.K8sArgs, conf *types.NetConf, kubeClient
|
||||
delegates, err := GetK8sNetwork(kubeClient, k8sArgs, conf.ConfDir)
|
||||
if err != nil {
|
||||
if _, ok := err.(*NoK8sNetworkError); ok {
|
||||
return 0, nil, nil
|
||||
return 0, clientInfo, nil
|
||||
//return 0, nil, nil
|
||||
}
|
||||
return 0, nil, fmt.Errorf("Multus: Err in getting k8s network from pod: %v", err)
|
||||
}
|
||||
|
@ -263,10 +263,12 @@ func cmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient k8s.KubeClient) (cn
|
||||
}
|
||||
|
||||
//set the network status annotation in apiserver, only in case Multus as kubeconfig
|
||||
if n.Kubeconfig != "" && kc.Podnamespace != "kube-system" {
|
||||
err = k8s.SetNetworkStatus(kc, netStatus)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Multus: Err set the networks status: %v", err)
|
||||
if n.Kubeconfig != "" && kc != nil {
|
||||
if kc.Podnamespace != "kube-system" {
|
||||
err = k8s.SetNetworkStatus(kc, netStatus)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Multus: Err set the networks status: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,10 +319,12 @@ func cmdDel(args *skel.CmdArgs, exec invoke.Exec, kubeClient k8s.KubeClient) err
|
||||
}
|
||||
|
||||
//unset the network status annotation in apiserver, only in case Multus as kubeconfig
|
||||
if in.Kubeconfig != "" && kc.Podnamespace != "kube-system" {
|
||||
err := k8s.SetNetworkStatus(kc, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Multus: Err unset the networks status: %v", err)
|
||||
if in.Kubeconfig != "" && kc != nil {
|
||||
if kc.Podnamespace != "kube-system" {
|
||||
err := k8s.SetNetworkStatus(kc, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Multus: Err unset the networks status: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user