Skip to content

Commit

Permalink
CLI is able to work with existing stopped minikube (kyma-project#49)
Browse files Browse the repository at this point in the history
* update to latest kyma

* merge

* update version

* update version

* Added an ability to start stopped minikube kyma cluster
  • Loading branch information
igor-karpukhin authored Mar 22, 2019
1 parent d43fe72 commit 2e7e6ac
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/kyma/cmd/provision/minikube/cmd.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package minikube

import (
"errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -52,6 +53,7 @@ var (
"kvm2",
"none",
}
ErrMinikubeRunning = errors.New("Minikube already running")
)

//MinikubeOptions defines available options for the command
Expand All @@ -73,10 +75,9 @@ func NewOptions(o *core.Options) *MinikubeOptions {
//NewCmd creates a new minikube command
func NewCmd(o *MinikubeOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "minikube",
Short: "Provisions minikube",
Long: `Provisions minikube for Kyma installation
`,
Use: "minikube",
Short: "Provisions minikube",
Long: `Provisions minikube for Kyma installation`,
RunE: func(_ *cobra.Command, _ []string) error { return o.Run() },
Aliases: []string{"m"},
}
Expand Down Expand Up @@ -104,7 +105,10 @@ func (o *MinikubeOptions) Run() error {

s = o.NewStep("Check minikube status")
err = checkIfMinikubeIsInitialized(o, s)
if err != nil {
switch err {
case ErrMinikubeRunning, nil:
break
default:
s.Failure()
return err
}
Expand Down Expand Up @@ -225,7 +229,7 @@ func checkIfMinikubeIsInitialized(o *MinikubeOptions, s step.Step) error {
return err
}
} else {
return fmt.Errorf("minikube installation cancelled")
return ErrMinikubeRunning
}
}
return nil
Expand Down

0 comments on commit 2e7e6ac

Please sign in to comment.