If set, use $KUBECONFIG when creating a new client
@@ -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)
