Skip to content

Commit

Permalink
Fix the way 'minikube status' finds the kubecfg file.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorenc authored and dlorenc committed Jul 24, 2017
1 parent 8eaf471 commit 24e08b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 1 addition & 7 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,7 @@ func runStart(cmd *cobra.Command, args []string) {
fmt.Println("Setting up kubeconfig...")
// setup kubeconfig

kubeConfigEnv := os.Getenv(constants.KubeconfigEnvVar)
var kubeConfigFile string
if kubeConfigEnv == "" {
kubeConfigFile = constants.KubeconfigPath
} else {
kubeConfigFile = filepath.SplitList(kubeConfigEnv)[0]
}
kubeConfigFile := cmdUtil.GetKubeConfigPath()

kubeCfgSetup := &kubeconfig.KubeConfigSetup{
ClusterName: cfg.GetMachineName(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var statusCmd = &cobra.Command{
glog.Errorln("Error host driver ip status:", err)
cmdUtil.MaybeReportErrorAndExit(err)
}
kstatus, err := kubeconfig.GetKubeConfigStatus(ip, constants.KubeconfigPath, config.GetMachineName())
kstatus, err := kubeconfig.GetKubeConfigStatus(ip, cmdUtil.GetKubeConfigPath(), config.GetMachineName())
if err != nil {
glog.Errorln("Error kubeconfig status:", err)
cmdUtil.MaybeReportErrorAndExit(err)
Expand Down
8 changes: 8 additions & 0 deletions cmd/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,11 @@ func KillMountProcess() error {
}
return mountProc.Kill()
}

func GetKubeConfigPath() string {
kubeConfigEnv := os.Getenv(constants.KubeconfigEnvVar)
if kubeConfigEnv == "" {
return constants.KubeconfigPath
}
return filepath.SplitList(kubeConfigEnv)[0]
}

0 comments on commit 24e08b7

Please sign in to comment.