Skip to content

Commit

Permalink
Skip communicate with kubernets api failure
Browse files Browse the repository at this point in the history
Multus is failing when can't communicate with kube-api, which fails
to create pods even in case of not using network attachment.

This change makes multus skip the failures of communicating with kube-api
and create the networks of delegates

Signed-off-by: Mamduh Alassi <mamduhala@mellanox.com>
  • Loading branch information
Mmduh-483 committed Jan 31, 2021
1 parent f6df613 commit 1841027
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/multus/multus.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,10 @@ func CmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) (c
return nil, cmdErr(k8sArgs, "error getting pod by service unavailable: %v", err)
}
} else {
// Other case, return error
return nil, cmdErr(k8sArgs, "error getting pod: %v", err)
// Other case, print warning and return nil
logging.Debugf("%v", cmdErr(k8sArgs, "error getting pod: %v", err))
kubeClient = nil
err = nil
}
}
}
Expand Down Expand Up @@ -670,7 +672,7 @@ 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
if n.Kubeconfig != "" && kc != nil {
if n.Kubeconfig != "" && kc != nil && kubeClient != nil {
if !types.CheckSystemNamespaces(string(k8sArgs.K8S_POD_NAME), n.SystemNamespaces) {
err = k8s.SetNetworkStatus(kubeClient, k8sArgs, netStatus, n)
if err != nil {
Expand Down

0 comments on commit 1841027

Please sign in to comment.