fix wait retry logic
parent
c04a5a6ca4
commit
9116393aa3
|
@ -806,7 +806,7 @@ func setDockerProxy() {
|
|||
func autoSetDriverOptions(cmd *cobra.Command, drvName string) (err error) {
|
||||
err = nil
|
||||
hints := driver.FlagDefaults(drvName)
|
||||
if !cmd.Flags().Changed("extra-config") && len(hints.ExtraOptions) > 0 {
|
||||
if len(hints.ExtraOptions) > 0 {
|
||||
for _, eo := range hints.ExtraOptions {
|
||||
glog.Infof("auto setting extra-config to %q.", eo)
|
||||
err = config.ExtraOptions.Set(eo)
|
||||
|
|
1
go.sum
1
go.sum
|
@ -1082,6 +1082,7 @@ k8s.io/kubelet v0.17.3 h1:e6oo26NusXf6i7Pp6i5tWXT+Z/oQW0XzxiWxa5pBgw0=
|
|||
k8s.io/kubelet v0.17.3/go.mod h1:Nh8owUHZcUXtnDAtmGnip36Nw+X6c4rbmDQlVyIhwMQ=
|
||||
k8s.io/kubernetes v1.17.3 h1:zWCppkLfHM+hoLqfbsrQ0cJnYw+4vAvedI92oQnjo/Q=
|
||||
k8s.io/kubernetes v1.17.3/go.mod h1:gt28rfzaskIzJ8d82TSJmGrJ0XZD0BBy8TcQvTuCI3w=
|
||||
k8s.io/kubernetes v1.18.0 h1:rVe+edi5GwutPQJ4KIZq1Nk506nmnfyz/KOZVCLv7Yo=
|
||||
k8s.io/legacy-cloud-providers v0.17.3/go.mod h1:ujZML5v8efVQxiXXTG+nck7SjP8KhMRjUYNIsoSkYI0=
|
||||
k8s.io/metrics v0.17.3 h1:IqXkNK+5E3vnobFD923Mn1QJEt3fb6+sK0wIjtBzOvw=
|
||||
k8s.io/metrics v0.17.3/go.mod h1:HEJGy1fhHOjHggW9rMDBJBD3YuGroH3Y1pnIRw9FFaI=
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
core "k8s.io/api/core/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
@ -36,7 +35,6 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||
"k8s.io/minikube/pkg/minikube/logs"
|
||||
"k8s.io/minikube/pkg/util/retry"
|
||||
)
|
||||
|
||||
// WaitForSystemPods verifies essential pods for running kurnetes is running
|
||||
|
@ -113,9 +111,16 @@ func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error {
|
|||
func WaitForAppsRunning(cs *kubernetes.Clientset, expected []string, timeout time.Duration) error {
|
||||
glog.Info("waiting for k8s-apps to be running ...")
|
||||
start := time.Now()
|
||||
checkRunning := func() error { return ExpectAppsRunning(cs, expected) }
|
||||
if err := retry.Expo(checkRunning, 500*time.Millisecond, timeout); err != nil {
|
||||
return errors.Wrap(err, "waitings for k8s app running")
|
||||
|
||||
checkRunning := func() (bool, error) {
|
||||
if err := ExpectAppsRunning(cs, expected); err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
if err := wait.PollImmediate(kconst.APICallRetryInterval, timeout, checkRunning); err != nil {
|
||||
return fmt.Errorf("apiserver never returned a pod list")
|
||||
}
|
||||
glog.Infof("duration metric: took %s to wait for k8s-apps to be running ...", time.Since(start))
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue