yashbhutwala / kubectl-df-pv

kubectl plugin - giving admins df (disk free) like utility for persistent volumes
Apache License 2.0
403 stars 32 forks source link

~/.kube/config shouldn't be required #8

Closed lbohnsac closed 4 years ago

lbohnsac commented 4 years ago

i just upgraded the df-pv plugin from v0.1.5 to v0.2.4 ...

Unfortunately now the file ~/.kube/config is required! Only with a successful login this file exists. If you're logged in via kubeconfig (export KUBECONFIG=/path/to/kubeconfig) this file doesn't exists and the plugin crashes with the following error message:

oc df-pv

Error: error getting output slice: unable to build config from flags: stat /root/.kube/config: no such file or directory Usage: df-pv [flags]

Flags: -h, --help help for df-pv -n, --namespace string if present, the namespace scope for this CLI request (default is all namespaces) -v, --verbosity string log level; one of [info, debug, trace, warn, error, fatal, panic] (default "info")

FATA[2020-07-13T15:48:40+02:00] unable to run root command: stat /root/.kube/config: no such file or directory unable to build config from flags github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.GetSliceOfOutputRowPVC /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:442 github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.runRootCommand /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:70 github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.setupRootCommand.func1 /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:53 github.com/spf13/cobra.(Command).execute /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:842 github.com/spf13/cobra.(Command).ExecuteC /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:950 github.com/spf13/cobra.(Command).Execute /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:887 github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:30 main.main /home/runner/work/kubectl-df-pv/kubectl-df-pv/cmd/df-pv/main.go:10 runtime.main /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/proc.go:203 runtime.goexit /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/asm_amd64.s:1373 error getting output slice github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.runRootCommand /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:72 github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.setupRootCommand.func1 /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:53 github.com/spf13/cobra.(Command).execute /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:842 github.com/spf13/cobra.(Command).ExecuteC /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:950 github.com/spf13/cobra.(Command).Execute /home/runner/work/kubectl-df-pv/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:887 github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:30 main.main /home/runner/work/kubectl-df-pv/kubectl-df-pv/cmd/df-pv/main.go:10 runtime.main /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/proc.go:203 runtime.goexit /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/asm_amd64.s:1373 run df-pv root command github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute /home/runner/work/kubectl-df-pv/kubectl-df-pv/pkg/df-pv/root.go:30 main.main /home/runner/work/kubectl-df-pv/kubectl-df-pv/cmd/df-pv/main.go:10 runtime.main /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/proc.go:203 runtime.goexit /opt/hostedtoolcache/go/1.14.4/x64/src/runtime/asm_amd64.s:1373

This file shouldn't be required ... it worked in v0.1.5 without any issues! :(

yashbhutwala commented 4 years ago

I was trying to reduce dependency on the cli generator and use kubeconfig file directly. I didn't think people would be relying on that functionality and mostly used ~/.kube/config. I should have remembered about Hyrum's Law šŸ˜„. I will fix this soon, sorry for the inconvenience. Thanks for reporting! šŸ™

yashbhutwala commented 4 years ago

Fixed via https://github.com/yashbhutwala/kubectl-df-pv/commit/ddfa9d816c5e7e661b109e05e40d28f8c9c9e412, essentially reverting https://github.com/yashbhutwala/kubectl-df-pv/commit/3fabe2e88ce2d9e3721de803536284b7c2e66561. It will be released soon as v0.2.5

yashbhutwala commented 4 years ago

https://github.com/yashbhutwala/kubectl-df-pv/releases/tag/v0.2.5 released! Apologize again for the breakage šŸ™ƒ and thanks again for using and reporting šŸ‘

lbohnsac commented 4 years ago

If you have to manage a lot of different clusters just switching from one to another kubeconfig is more comfortabe ... :)