From de74ee1eb4a5f557d568439d2c3ebcafaad524f7 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Tue, 27 Aug 2019 09:42:16 -0700 Subject: [PATCH] Announce environmental overrides up front --- cmd/minikube/cmd/start.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 0265b335799e..ff58b7c04d70 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -253,6 +253,7 @@ func runStart(cmd *cobra.Command, args []string) { prefix = fmt.Sprintf("[%s] ", viper.GetString(cfg.MachineProfile)) } out.T(out.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version.GetVersion(), "platform": platform()}) + displayEnviron(os.Environ()) // if --registry-mirror specified when run minikube start, // take arg precedence over MINIKUBE_REGISTRY_MIRROR @@ -331,7 +332,18 @@ func runStart(cmd *cobra.Command, args []string) { } } showKubectlConnectInfo(kubeconfig) +} +// displayEnviron makes the user aware of environment variables that will affect how minikube operates +func displayEnviron(env []string) { + for _, kv := range env { + bits := strings.SplitN(kv, "=", 2) + k := bits[0] + v := bits[1] + if strings.HasPrefix(k, "MINIKUBE_") || k == constants.KubeconfigEnvVar { + out.T(out.Option, "{{.key}}={{.value}}", out.V{"key": k, "value": v}) + } + } } func setupKubeconfig(h *host.Host, c *cfg.Config) (*kubeconfig.Settings, error) { @@ -354,6 +366,7 @@ func setupKubeconfig(h *host.Host, c *cfg.Config) (*kubeconfig.Settings, error) KeepContext: viper.GetBool(keepContext), EmbedCerts: viper.GetBool(embedCerts), } + kcs.SetPath(kubeconfig.PathFromEnv()) if err := kubeconfig.Update(kcs); err != nil { return kcs, err