mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-20 17:10:09 +00:00
Merge pull request #1407 from dougbtv/pod-deleted-on-add
Tolerate issues writing network status annotation on CNI ADD.
This commit is contained in:
@@ -796,18 +796,20 @@ func CmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) (c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the network status annotation in apiserver, only in case Multus as kubeconfig
|
// set the network status annotation in apiserver, only in case Multus has kubeconfig
|
||||||
if kubeClient != nil && kc != nil {
|
if kubeClient != nil && kc != nil {
|
||||||
if !types.CheckSystemNamespaces(string(k8sArgs.K8S_POD_NAME), n.SystemNamespaces) {
|
if !types.CheckSystemNamespaces(string(k8sArgs.K8S_POD_NAME), n.SystemNamespaces) {
|
||||||
err = k8s.SetNetworkStatus(kubeClient, k8sArgs, netStatus, n)
|
err = k8s.SetNetworkStatus(kubeClient, k8sArgs, netStatus, n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "failed to query the pod") {
|
if strings.Contains(err.Error(), `pod "`) && strings.Contains(err.Error(), `" not found`) {
|
||||||
return nil, cmdErr(k8sArgs, "error setting the networks status, pod was already deleted: %v", err)
|
// Tolerate issues with writing the status due to pod deletion, and log them.
|
||||||
}
|
logging.Verbosef("warning: tolerated failure writing network status (pod not found): %v", err)
|
||||||
|
} else {
|
||||||
return nil, cmdErr(k8sArgs, "error setting the networks status: %v", err)
|
return nil, cmdErr(k8sArgs, "error setting the networks status: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user