Handle multiple KUBECONFIGs

pull/861/head
dlorenc 2016-11-29 11:09:55 -08:00
parent bc5f3f0489
commit b9d78a675d
1 changed files with 6 additions and 2 deletions

View File

@ -19,6 +19,7 @@ package cmd
import ( import (
"fmt" "fmt"
"os" "os"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -159,9 +160,12 @@ func calculateDiskSizeInMB(humanReadableDiskSize string) int {
// If no CurrentContext is set, the given name will be used. // If no CurrentContext is set, the given name will be used.
func setupKubeconfig(name, server, certAuth, cliCert, cliKey string) error { func setupKubeconfig(name, server, certAuth, cliCert, cliKey string) error {
configFile := os.Getenv(constants.KubeconfigEnvVar) configEnv := os.Getenv(constants.KubeconfigEnvVar)
if configFile == "" { var configFile string
if configEnv == "" {
configFile = constants.KubeconfigPath configFile = constants.KubeconfigPath
} else {
configFile = filepath.SplitList(configEnv)[0]
} }
glog.Infoln("Using kubeconfig: ", configFile) glog.Infoln("Using kubeconfig: ", configFile)