bonnefoa / kubectl-fzf

A fast kubectl autocompletion with fzf
MIT License
447 stars 33 forks source link

can't use in clusters without read namespace permission #35

Closed smf8 closed 2 years ago

smf8 commented 2 years ago

When i try to run the server against a cluster in which I have access to only a certain list of namespaces, The application will exit with current log:

FATA[2022-08-29T17:30:04+04:30]util.go:38 kubectlfzf/pkg/util.FatalIf() Fatal error: error fetching namespaces: namespaces is forbidden: User "xxxxxx" cannot list namespaces at the cluster scope: User "xxxxx" cannot list all namespaces in the cluster

Also I tried setting --excluded-resources nodes,namespaces --watched-namespaces xxxxx flags for the server, but it didn't help. One possible solution that I can think of is to provide a way to bypass the execution of this line.

namespaces, err := clientset.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
bonnefoa commented 2 years ago

This should be fixed in https://github.com/bonnefoa/kubectl-fzf/commit/ecf68ee67335207838db45c87e1c5a7b3d9c35a2