Add support for the KUBECONFIG env var during 'minikube start'.

pull/731/head
dlorenc 2016-10-20 11:41:11 -07:00
parent c9389ee6fa
commit 20e6b2a56f
2 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package cmd
import (
"fmt"
"os"
"strconv"
"strings"
@ -152,7 +153,13 @@ func calculateDiskSizeInMB(humanReadableDiskSize string) int {
// activeContext is true when minikube is the CurrentContext
// If no CurrentContext is set, the given name will be used.
func setupKubeconfig(name, server, certAuth, cliCert, cliKey string) error {
configFile := constants.KubeconfigPath
configFile := os.Getenv(constants.KubeconfigEnvVar)
if configFile == "" {
configFile = constants.KubeconfigPath
}
glog.Infoln("Using kubeconfig: ", configFile)
// read existing config or create new if does not exist
config, err := kubeconfig.ReadConfigOrNew(configFile)

View File

@ -36,6 +36,9 @@ var Minipath = filepath.Join(homedir.HomeDir(), ".minikube")
// KubeconfigPath is the path to the Kubernetes client config
var KubeconfigPath = clientcmd.RecommendedHomeFile
// KubeconfigEnvVar is the env var to check for the Kubernetes client config
var KubeconfigEnvVar = clientcmd.RecommendedConfigPathEnvVar
// MinikubeContext is the kubeconfig context name used for minikube
const MinikubeContext = "minikube"