Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honour Local path flag while saving kube configs #416

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
alessandroargentieri marked this conversation as resolved.
Show resolved Hide resolved

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
Loading