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

Fix kubeConfigPath #6568

Merged
merged 2 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions cmd/minikube/cmd/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/spf13/viper"
pkgConfig "k8s.io/minikube/pkg/minikube/config"
pkg_config "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/out"
Expand Down Expand Up @@ -87,7 +86,7 @@ var ProfileCmd = &cobra.Command{
out.SuccessT("Skipped switching kubectl context for {{.profile_name}} because --keep-context was set.", out.V{"profile_name": profile})
out.SuccessT("To connect to this cluster, use: kubectl --context={{.profile_name}}", out.V{"profile_name": profile})
} else {
err := kubeconfig.SetCurrentContext(profile, constants.KubeconfigPath)
err := kubeconfig.SetCurrentContext(profile, kubeconfig.PathFromEnv())
if err != nil {
out.ErrT(out.Sad, `Error while setting kubectl current context : {{.error}}`, out.V{"error": err})
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/minikube/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/cluster"
pkg_config "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/machine"
Expand Down Expand Up @@ -82,7 +81,7 @@ func runStop(cmd *cobra.Command, args []string) {
out.T(out.WarningType, "Unable to kill mount process: {{.error}}", out.V{"error": err})
}

err = kubeconfig.UnsetCurrentContext(profile, constants.KubeconfigPath)
err = kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv())
if err != nil {
exit.WithError("update config", err)
}
Expand Down
11 changes: 1 addition & 10 deletions cmd/minikube/cmd/update-context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ limitations under the License.
package cmd

import (
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/machine"
Expand All @@ -47,13 +44,7 @@ var updateContextCmd = &cobra.Command{
if err != nil {
exit.WithError("Error host driver ip status", err)
}
var updated bool
kubeConfigPath := os.Getenv("KUBECONFIG")
if kubeConfigPath == "" {
updated, err = kubeconfig.UpdateIP(ip, machineName, constants.KubeconfigPath)
} else {
updated, err = kubeconfig.UpdateIP(ip, machineName, kubeConfigPath)
}
updated, err := kubeconfig.UpdateIP(ip, machineName, kubeconfig.PathFromEnv())
if err != nil {
exit.WithError("update config", err)
}
Expand Down