Skip to content

Commit

Permalink
Added check that kubeconfig exists in path provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
Micah Huber committed Sep 7, 2018
1 parent 87cc034 commit 707aef2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lookup/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ func getClientSet() (*kubernetes.Clientset, error) {
}
flag.Parse()


if _, err := os.Stat(kubeconfig); err != nil {
// kubeconfig doesn't exist
fmt.Printf("%s does not exist - please make sure you have a kubeconfig configured.\n", kubeconfig)
os.Exit(1)
}

// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
Expand Down

0 comments on commit 707aef2

Please sign in to comment.