Skip to content

Commit

Permalink
Honour Local path flag while saving kube configs
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed May 8, 2024
1 parent 7017fa6 commit 5ee9938
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions cmd/kubernetes/kubernetes_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Notes:

var saveConfig, switchConfig, overwriteConfig bool
var localPathConfig string
var defaultKubeConfigPath = "/.kube/config"

var kubernetesConfigCmd = &cobra.Command{
Use: "config",
Expand Down Expand Up @@ -65,8 +66,12 @@ If you wish to use a custom format, the available fields are:
os.Exit(1)
}

if os.Getenv("KUBECONFIG") != "" {
localPathConfig = os.Getenv("KUBECONFIG")
if localPathConfig == "" { // Check if -p or --local-path argument was not provided
if os.Getenv("KUBECONFIG") != "" {
localPathConfig = os.Getenv("KUBECONFIG")
} else {
localPathConfig = defaultKubeConfigPath
}
}

if saveConfig {
Expand Down
2 changes: 1 addition & 1 deletion utility/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func checkAppPlan(appList []civogo.KubernetesMarketplaceApplication, requested s
return requested, nil
}

// RequestedSplit is a function to split all app requested to be install
// RequestedSplit is a function to split all app requested to be installed
func RequestedSplit(appList []civogo.KubernetesMarketplaceApplication, requested string) string {
allsplit := strings.Split(requested, ",")
allApp := []string{}
Expand Down

0 comments on commit 5ee9938

Please sign in to comment.