c-bata / kube-prompt

An interactive kubernetes client featuring auto-complete.
MIT License
1.79k stars 134 forks source link

Fails if there's no config in ~/.kube #16

Closed tarekmehrez closed 6 years ago

tarekmehrez commented 6 years ago

I have 3 different contexts, all set in KUBECONFIG. kube-prompt fails when I try to get a certain pod or service

>>> get pods panic: stat /Users/tarekmehrez/.kube/config: no such file or directory

goroutine 36 [running]:
github.com/c-bata/kube-prompt/kube.NewClient(0x0)
    /Users/a14737/go/src/github.com/c-bata/kube-prompt/kube/client.go:29 +0x140
github.com/c-bata/kube-prompt/kube.getClient(0x0)
    /Users/a14737/go/src/github.com/c-bata/kube-prompt/kube/client.go:14 +0x2e
github.com/c-bata/kube-prompt/kube.fetchPods()
    /Users/a14737/go/src/github.com/c-bata/kube-prompt/kube/resource.go:177 +0x72
created by github.com/c-bata/kube-prompt/kube.getPodSuggestions
    /Users/a14737/go/src/github.com/c-bata/kube-prompt/kube/resource.go:183 +0x39

Is there a way that this might work just by checking my current context?

ultimateboy commented 6 years ago

Same as #10.