-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding kubectl test for minikube #398
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package cmd | |
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"strconv" | ||
"strings" | ||
|
||
|
@@ -49,7 +50,7 @@ var startCmd = &cobra.Command{ | |
Use: "start", | ||
Short: "Starts a local kubernetes cluster.", | ||
Long: `Starts a local kubernetes cluster using Virtualbox. This command | ||
assumes you already have Virtualbox installed.`, | ||
assumes you already have Virtualbox & kubectl installed.`, | ||
Run: runStart, | ||
} | ||
|
||
|
@@ -102,6 +103,15 @@ func runStart(cmd *cobra.Command, args []string) { | |
kubeHost = strings.Replace(kubeHost, ":2376", ":"+strconv.Itoa(constants.APIServerPort), -1) | ||
fmt.Printf("Kubernetes is available at %s.\n", kubeHost) | ||
|
||
//Checking for kubectl | ||
fmt.Printf("Checking for Kubectl ...\n") | ||
path, err := exec.LookPath("kubectl") | ||
if err != nil { | ||
log.Fatal("Kubectl is not installed.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you switch this to something like: glog.Errorln("Kubectl is not installed.")
os.Exit(1) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually lets just leave this as a warning, kubectl isn't the only way to interact with kubernetes so we shouldn't error if the user doesn't have it installed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wonder if we can add a better help message to direct where to download it from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @jimmidyson for the suggestion.I will add some nice suggestion for kubectl. |
||
} | ||
fmt.Printf("Kubectl is configured and installed.") | ||
|
||
|
||
// setup kubeconfig | ||
name := constants.MinikubeContext | ||
certAuth := constants.MakeMiniPath("ca.crt") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be: