Skip to content

Commit b9fc5fb

Browse files
adds check for kubectl (#267)
Signed-off-by: Paul S. Schweigert <[email protected]> Co-authored-by: Paul S. Schweigert <[email protected]>
1 parent 6424866 commit b9fc5fb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/kind/kind.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ var kindVersion = 0.11
3333
// SetUp creates a local Kind cluster and installs all the relevant Knative components
3434
func SetUp(name, kVersion string) error {
3535
start := time.Now()
36+
37+
// kubectl is required, fail if not found
38+
if _, err := exec.LookPath("kubectl"); err != nil {
39+
fmt.Println("ERROR: kubectl is required for quickstart")
40+
fmt.Println("Download from https://kubectl.docs.kubernetes.io/installation/kubectl/")
41+
os.Exit(1)
42+
}
43+
3644
clusterName = name
3745
if kVersion != "" {
3846
if strings.Contains(kVersion, ":") {

pkg/minikube/minikube.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ var memory = "3072"
3737
// SetUp creates a local Minikube cluster and installs all the relevant Knative components
3838
func SetUp(name, kVersion string) error {
3939
start := time.Now()
40+
41+
// kubectl is required, fail if not found
42+
if _, err := exec.LookPath("kubectl"); err != nil {
43+
fmt.Println("ERROR: kubectl is required for quickstart")
44+
fmt.Println("Download from https://kubectl.docs.kubernetes.io/installation/kubectl/")
45+
os.Exit(1)
46+
}
47+
4048
clusterName = name
4149
if kVersion != "" {
4250
kubernetesVersion = kVersion

0 commit comments

Comments
 (0)