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

Announce environmental overrides up front #5212

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Changes from all commits
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
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