Skip to content

Commit

Permalink
Merge pull request #5212 from tstromberg/kconfig
Browse files Browse the repository at this point in the history
Announce environmental overrides up front
  • Loading branch information
tstromberg authored Aug 27, 2019
2 parents 2912913 + de74ee1 commit 2205bb8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 2205bb8

Please sign in to comment.