mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-23 02:17:50 +00:00
Default network readiness fix conflicts after rebase
This commit is contained in:
committed by
Tomofumi Hayashi
parent
1caddaef4f
commit
21cdfe5485
@@ -24,6 +24,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
"github.com/containernetworking/cni/pkg/invoke"
|
||||
@@ -35,8 +36,16 @@ import (
|
||||
"github.com/intel/multus-cni/logging"
|
||||
"github.com/intel/multus-cni/types"
|
||||
"github.com/vishvananda/netlink"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
)
|
||||
|
||||
var defaultReadinessBackoff = wait.Backoff{
|
||||
Steps: 4,
|
||||
Duration: 250 * time.Millisecond,
|
||||
Factor: 4.0,
|
||||
Jitter: 0.1,
|
||||
}
|
||||
|
||||
func saveScratchNetConf(containerID, dataDir string, netconf []byte) error {
|
||||
logging.Debugf("saveScratchNetConf: %s, %s, %s", containerID, dataDir, string(netconf))
|
||||
if err := os.MkdirAll(dataDir, 0700); err != nil {
|
||||
@@ -228,6 +237,16 @@ func cmdAdd(args *skel.CmdArgs, exec invoke.Exec, kubeClient k8s.KubeClient) (cn
|
||||
return nil, logging.Errorf("Multus: Err in getting k8s args: %v", err)
|
||||
}
|
||||
|
||||
wait.ExponentialBackoff(defaultReadinessBackoff, func() (bool, error) {
|
||||
_, err := os.Stat(n.ReadinessIndicatorFile)
|
||||
switch {
|
||||
case err == nil:
|
||||
return true, nil
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
})
|
||||
|
||||
numK8sDelegates, kc, err := k8s.TryLoadK8sDelegates(k8sArgs, n, kubeClient)
|
||||
if err != nil {
|
||||
return nil, logging.Errorf("Multus: Err in loading K8s Delegates k8s args: %v", err)
|
||||
|
Reference in New Issue
Block a user