update-context: Automatically set the context as current/active in kubeconfig
parent
38da8de55d
commit
9fbd2e94bd
|
@ -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})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue