Skip to content

Commit

Permalink
Merge pull request #9281 from prezha/update-context-activates-context
Browse files Browse the repository at this point in the history
update-context: Automatically set the context as current/active in ku…
  • Loading branch information
medyagh authored Sep 21, 2020
2 parents 0a6b52d + 9fbd2e9 commit f5b74f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/minikube/cmd/update-context.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@ var updateContextCmd = &cobra.Command{
} else {
out.T(style.Meh, `No changes required for the "{{.context}}" context`, out.V{"context": cname})
}

if err := kubeconfig.SetCurrentContext(cname, kubeconfig.PathFromEnv()); err != nil {
out.ErrT(style.Sad, `Error while setting kubectl current context: {{.error}}`, out.V{"error": err})
} else {
out.T(style.Kubectl, `Current context is "{{.context}}"`, out.V{"context": cname})
}
},
}

0 comments on commit f5b74f9

Please sign in to comment.