File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -13,30 +13,27 @@ import (
1313)
1414
1515func getConfig () (* rest.Config , error ) {
16- // Try in-cluster config first (for running inside K8s pods)
1716 config , err := rest .InClusterConfig ()
1817 if err == nil {
1918 return config , nil
2019 }
2120
22- // Check KUBECONFIG environment variable
23- kubeconfigPath := os .Getenv ("KUBECONFIG" )
24- if kubeconfigPath != "" {
25- config , err = clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
21+ kubeconfig := os .Getenv ("KUBECONFIG" )
22+ if kubeconfig != "" {
23+ config , err = clientcmd .BuildConfigFromFlags ("" , kubeconfig )
2624 if err != nil {
2725 return nil , err
2826 }
2927 return config , nil
3028 }
3129
32- // Fall back to default kubeconfig location
3330 home := homedir .HomeDir ()
3431 if home == "" {
3532 return nil , fmt .Errorf ("could not determine home directory" )
3633 }
3734
38- kubeconfigPath = filepath .Join (home , ".kube" , "config" )
39- config , err = clientcmd .BuildConfigFromFlags ("" , kubeconfigPath )
35+ kubeconfig = filepath .Join (home , ".kube" , "config" )
36+ config , err = clientcmd .BuildConfigFromFlags ("" , kubeconfig )
4037 if err != nil {
4138 return nil , err
4239 }
You can’t perform that action at this time.
0 commit comments