Skip to content

Commit

Permalink
add the KUBECONFIG check
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo Castellotti authored and liyinan926 committed Sep 24, 2018
1 parent 33f8cd1 commit 17883cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sparkctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ import (
"github.com/spf13/cobra"
)

var defaultKubeConfig = os.Getenv("HOME") + "/.kube/config"
func getKubeConfigPath() string {
var kubeConfigEnv = os.Getenv("KUBECONFIG")
if len(kubeConfigEnv) == 0 {
return os.Getenv("HOME") + "/.kube/config"
}
return kubeConfigEnv
}

var defaultKubeConfig = getKubeConfigPath()

var Namespace string
var KubeConfig string
Expand Down

0 comments on commit 17883cf

Please sign in to comment.