diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index 51957e4b58..cba6f43c22 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -84,7 +84,8 @@ var dashboardCmd = &cobra.Command{ svc := "kubernetes-dashboard" out.ErrT(out.Verifying, "Verifying dashboard health ...") checkSVC := func() error { return service.CheckService(ns, svc) } - if err = retry.Expo(checkSVC, 1*time.Second, time.Minute*5); err != nil { + // for slow machines or parallels in CI to avoid #7503 + if err = retry.Expo(checkSVC, 100*time.Microsecond, time.Minute*10); err != nil { exit.WithCodeT(exit.Unavailable, "dashboard service is not running: {{.error}}", out.V{"error": err}) } @@ -97,7 +98,7 @@ var dashboardCmd = &cobra.Command{ out.ErrT(out.Verifying, "Verifying proxy health ...") chkURL := func() error { return checkURL(url) } - if err = retry.Expo(chkURL, 1*time.Second, 3*time.Minute); err != nil { + if err = retry.Expo(chkURL, 100*time.Microsecond, 10*time.Minute); err != nil { exit.WithCodeT(exit.Unavailable, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err}) } diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index b39ee3f601..3b5666e9dd 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -244,7 +244,7 @@ func enableOrDisableAddonInternal(cc *config.ClusterConfig, addon *assets.Addon, return err } - return retry.Expo(apply, 1*time.Second, time.Second*30) + return retry.Expo(apply, 100*time.Microsecond, time.Minute) } // enableOrDisableStorageClasses enables or disables storage classes diff --git a/pkg/minikube/bootstrapper/bsutil/kverify/default_sa.go b/pkg/minikube/bootstrapper/bsutil/kverify/default_sa.go index 453edff703..072446a254 100644 --- a/pkg/minikube/bootstrapper/bsutil/kverify/default_sa.go +++ b/pkg/minikube/bootstrapper/bsutil/kverify/default_sa.go @@ -18,36 +18,36 @@ limitations under the License. package kverify import ( - "fmt" "time" "github.com/golang/glog" "github.com/pkg/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" - "k8s.io/minikube/pkg/util/retry" + kconst "k8s.io/kubernetes/cmd/kubeadm/app/constants" ) // WaitForDefaultSA waits for the default service account to be created. func WaitForDefaultSA(cs *kubernetes.Clientset, timeout time.Duration) error { glog.Info("waiting for default service account to be created ...") start := time.Now() - saReady := func() error { + saReady := func() (bool, error) { // equivalent to manual check of 'kubectl --context profile get serviceaccount default' sas, err := cs.CoreV1().ServiceAccounts("default").List(meta.ListOptions{}) if err != nil { glog.Infof("temproary error waiting for default SA: %v", err) - return err + return false, nil } for _, sa := range sas.Items { if sa.Name == "default" { glog.Infof("found service account: %q", sa.Name) - return nil + return true, nil } } - return fmt.Errorf("couldn't find default service account") + return false, nil } - if err := retry.Expo(saReady, 500*time.Millisecond, timeout); err != nil { + if err := wait.PollImmediate(kconst.APICallRetryInterval, timeout, saReady); err != nil { return errors.Wrapf(err, "waited %s for SA", time.Since(start)) } diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 3ae20295e4..c91f4b6f7c 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -522,7 +522,7 @@ func (k *Bootstrapper) restartCluster(cfg config.ClusterConfig) error { _, err := k.c.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("%s phase addon all --config %s", baseCmd, conf))) return err } - if err = retry.Expo(addonPhase, 1*time.Second, 30*time.Second); err != nil { + if err = retry.Expo(addonPhase, 100*time.Microsecond, 30*time.Second); err != nil { glog.Warningf("addon install failed, wil retry: %v", err) return errors.Wrap(err, "addons") } diff --git a/pkg/provision/buildroot.go b/pkg/provision/buildroot.go index 2f630f9332..50fb6a28ae 100644 --- a/pkg/provision/buildroot.go +++ b/pkg/provision/buildroot.go @@ -177,7 +177,7 @@ func (p *BuildrootProvisioner) Provision(swarmOptions swarm.Options, authOptions return nil } - err := retry.Expo(configAuth, time.Second, 2*time.Minute) + err := retry.Expo(configAuth, 100*time.Microsecond, 2*time.Minute) if err != nil { glog.Infof("Error configuring auth during provisioning %v", err) return err diff --git a/pkg/provision/ubuntu.go b/pkg/provision/ubuntu.go index 3fbf006b69..29349cd66c 100644 --- a/pkg/provision/ubuntu.go +++ b/pkg/provision/ubuntu.go @@ -180,7 +180,7 @@ func (p *UbuntuProvisioner) Provision(swarmOptions swarm.Options, authOptions au return nil } - err := retry.Expo(configAuth, time.Second, 2*time.Minute) + err := retry.Expo(configAuth, 100*time.Microsecond, 2*time.Minute) if err != nil { glog.Infof("Error configuring auth during provisioning %v", err)