From 42a62990a22151647124f0a7c2e863a172f89367 Mon Sep 17 00:00:00 2001 From: Nick Jones Date: Mon, 1 Jul 2019 10:10:42 +0100 Subject: [PATCH] If set, use $KUBECONFIG when creating a new client (#472) --- pkg/kudoctl/cmd/install/install.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/kudoctl/cmd/install/install.go b/pkg/kudoctl/cmd/install/install.go index 3d999c600..ba33abe19 100644 --- a/pkg/kudoctl/cmd/install/install.go +++ b/pkg/kudoctl/cmd/install/install.go @@ -19,10 +19,10 @@ type Options struct { AllDependencies bool AutoApprove bool InstanceName string + KubeConfigPath string Namespace string Parameters map[string]string PackageVersion string - KubeConfigPath string SkipInstance bool } @@ -40,6 +40,11 @@ func Run(cmd *cobra.Command, args []string, options *Options) error { return fmt.Errorf("get flag: %+v", err) } + // If the $KUBECONFIG environment variable is set, use that + if len(os.Getenv("KUBECONFIG")) > 0 { + options.KubeConfigPath = os.Getenv("KUBECONFIG") + } + configPath, err := check.KubeConfigLocationOrDefault(options.KubeConfigPath) if err != nil { return fmt.Errorf("error when getting default kubeconfig path: %+v", err)