File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"os"
24
24
"os/user"
25
25
"path"
26
+ "path/filepath"
26
27
27
28
"k8s.io/client-go/rest"
28
29
"k8s.io/client-go/tools/clientcmd"
@@ -97,7 +98,15 @@ func ResolveKubeConfigFile() string {
97
98
// if KUBECONFIG env is defined then use that
98
99
kubeConfigPath = os .Getenv (clientcmd .RecommendedConfigPathEnvVar )
99
100
if kubeConfigPath != "" {
100
- return kubeConfigPath
101
+ // handle the variable as a path list, similar to client-go.
102
+ filePaths := filepath .SplitList (kubeConfigPath )
103
+ for _ , filename := range filePaths {
104
+ if _ , err := os .Stat (filename ); err == nil {
105
+ return filename
106
+ }
107
+ }
108
+ // return the first path if none the paths existed.
109
+ return filePaths [0 ]
101
110
}
102
111
103
112
var (
You can’t perform that action at this time.
0 commit comments