Add support for the KUBECONFIG env var during 'minikube start'.
parent
c9389ee6fa
commit
20e6b2a56f
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue