Handle multiple KUBECONFIGs
parent
bc5f3f0489
commit
b9d78a675d
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue