diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index 0ba4f30b815c..e4c75d361b32 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -30,11 +30,11 @@ import ( "github.com/pkg/browser" "github.com/pkg/errors" "github.com/spf13/cobra" + configcmd "k8s.io/minikube/cmd/minikube/cmd/config" "k8s.io/minikube/pkg/minikube/cluster" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/machine" "k8s.io/minikube/pkg/minikube/service" - "k8s.io/minikube/pkg/util" ) @@ -65,19 +65,30 @@ var dashboardCmd = &cobra.Command{ } cluster.EnsureMinikubeRunningOrExit(api, 1) + fmt.Fprintln(os.Stderr, "Enabling dashboard ...") + // Enable the dashboard add-on + err = configcmd.Set("dashboard", "true") + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to enable dashboard: %v\n", err) + os.Exit(1) + } + ns := "kube-system" svc := "kubernetes-dashboard" - if err = util.RetryAfter(30, func() error { return service.CheckService(ns, svc) }, 1*time.Second); err != nil { + fmt.Fprintln(os.Stderr, "Verifying dashboard health ...") + if err = util.RetryAfter(180, func() error { return service.CheckService(ns, svc) }, 1*time.Second); err != nil { fmt.Fprintf(os.Stderr, "%s:%s is not running: %v\n", ns, svc, err) os.Exit(1) } + fmt.Fprintln(os.Stderr, "Launching proxy ...") p, hostPort, err := kubectlProxy() if err != nil { glog.Fatalf("kubectl proxy: %v", err) } url := dashboardURL(hostPort, ns, svc) + fmt.Fprintln(os.Stderr, "Verifying proxy health ...") if err = util.RetryAfter(60, func() error { return checkURL(url) }, 1*time.Second); err != nil { fmt.Fprintf(os.Stderr, "%s is not responding properly: %v\n", url, err) os.Exit(1) diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index 825de3b8e5bd..62dbde316178 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -74,7 +74,7 @@ var Addons = map[string]*Addon{ constants.AddonsPath, "dashboard-svc.yaml", "0640"), - }, true, "dashboard"), + }, false, "dashboard"), "default-storageclass": NewAddon([]*BinDataAsset{ NewBinDataAsset( "deploy/addons/storageclass/storageclass.yaml", diff --git a/test/integration/persistence_test.go b/test/integration/persistence_test.go index 5f048c8b2f8a..0d889ee9dd9e 100644 --- a/test/integration/persistence_test.go +++ b/test/integration/persistence_test.go @@ -44,10 +44,6 @@ func TestPersistence(t *testing.T) { } verify := func(t *testing.T) { - if err := util.WaitForDashboardRunning(t); err != nil { - t.Fatalf("waiting for dashboard to be up: %v", err) - } - if err := util.WaitForBusyboxRunning(t, "default"); err != nil { t.Fatalf("waiting for busybox to be up: %v", err) } diff --git a/test/integration/util/util.go b/test/integration/util/util.go index 7a4c11d77072..e854202a0009 100644 --- a/test/integration/util/util.go +++ b/test/integration/util/util.go @@ -65,7 +65,7 @@ func (m *MinikubeRunner) Run(cmd string) error { func (m *MinikubeRunner) Copy(f assets.CopyableFile) error { path, _ := filepath.Abs(m.BinaryPath) cmd := exec.Command("/bin/bash", "-c", path, "ssh", "--", fmt.Sprintf("cat >> %s", filepath.Join(f.GetTargetDir(), f.GetTargetName()))) - Logf("Running: %s", cmd) + Logf("Running: %s", cmd.Args) return cmd.Run() } @@ -144,6 +144,17 @@ func (m *MinikubeRunner) RunDaemon(command string) (*exec.Cmd, *bufio.Reader) { if err != nil { m.T.Fatalf("stdout pipe failed: %s %v", command, err) } + stderrPipe, err := cmd.StderrPipe() + if err != nil { + m.T.Fatalf("stderr pipe failed: %s %v", command, err) + } + + var errB bytes.Buffer + go func() { + if err := commonutil.TeePrefix(commonutil.ErrPrefix, stderrPipe, &errB, Logf); err != nil { + m.T.Logf("tee: %v", err) + } + }() err = cmd.Start() if err != nil { @@ -295,18 +306,6 @@ func WaitForBusyboxRunning(t *testing.T, namespace string) error { return commonutil.WaitForPodsWithLabelRunning(client, namespace, selector) } -func WaitForDashboardRunning(t *testing.T) error { - client, err := commonutil.GetClient() - if err != nil { - return errors.Wrap(err, "getting kubernetes client") - } - if err := commonutil.WaitForDeploymentToStabilize(client, "kube-system", "kubernetes-dashboard", time.Minute*10); err != nil { - return errors.Wrap(err, "waiting for dashboard deployment to stabilize") - } - - return nil -} - func WaitForIngressControllerRunning(t *testing.T) error { client, err := commonutil.GetClient() if err != nil {