Skip to content
Snippets Groups Projects
Unverified Commit 10bbf40f authored by Jess's avatar Jess Committed by GitHub
Browse files

Merge pull request #253 from lblackstone/ks-init-kubeconfig

Handle case where KUBECONFIG is set without named context
parents 50d0e48c 0f0d3747
No related branches found
No related tags found
No related merge requests found
......@@ -149,10 +149,11 @@ func resolveContext(context string) (server, namespace string, err error) {
// use the default context where context is empty
if context == "" {
if rawConfig.CurrentContext == "" {
if rawConfig.CurrentContext == "" && len(rawConfig.Clusters) == 0 {
// User likely does not have a kubeconfig file.
return "", "", fmt.Errorf("No current context found. Make sure a kubeconfig file is present")
}
// Note: "" is a valid rawConfig.CurrentContext
context = rawConfig.CurrentContext
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment