#TLDR:
--watch-namespaces does not exclude all other namespaces. It still watches all namespaces.
Details
Good day,
Thanks for such a useful tool for making Kubernetes administration faster!
Got tired of the slow auto complete in kubectl. Installed kubectl-fzfbut I use a private cluster that requires a VPN. The VPN is billed per data transferred so I did not want to monitor all namespaces and resources. I didn't deploy the kubectl-fzf-server server to the cluster, this is probably the best solution for my billing issues.
Issue
I started with: kubectl-fzf-server --watch-namespaces e2e-testing
But the output was unexpected, it was still watching all namespaces!
INFO[2023-10-20T12:06:04-04:00]resource_watcher.go:295 github.com/bonnefoa/kubectl-fzf/v3/internal/k8s/resourcewatcher.(*ResourceWatcher).watchResource() Start watch for pods on all namespaces
INFO[2023-10-20T12:09:59-04:00]resource_watcher.go:295 github.com/bonnefoa/kubectl-fzf/v3/internal/k8s/resourcewatcher.(*ResourceWatcher).watchResource() Start watch for configmaps on all namespaces
<etc.>
Workaround
I was able to work around this issue by using the --exclude-namespaces and a negative Perl regex, '/^(e2e-testing)/'
For example: kubectl-fzf-server --watch-namespaces 'e2e-testing' --exclude-namespaces '/^(e2e-testing)/'
Which results in the following output and works well:
INFO[2023-10-20T12:10:53-04:00]resource_watcher.go:195 github.com/bonnefoa/kubectl-fzf/v3/internal/k8s/resourcewatcher.(*ResourceWatcher).FetchNamespaces() namespace ack-lambda-controller not in watched namespace, excluding
<SNIP>
INFO[2023-10-20T12:10:53-04:00]resource_watcher.go:290 github.com/bonnefoa/kubectl-fzf/v3/internal/k8s/resourcewatcher.(*ResourceWatcher).watchResource() Start watch for pods on namespace [e2e-testing]
INFO[2023-10-20T12:10:53-04:00]resource_watcher.go:290 github.com/bonnefoa/kubectl-fzf/v3/internal/k8s/resourcewatcher.(*ResourceWatcher).watchResource() Start watch for configmaps on namespace [e2e-testing]
<SNIP>
Documentation
At first, I thought I would have to recompile kubectl-fzf-server since there was no documentation of CLI arguments. But I did find them tracing though the code and was able to get more details with kubectl-fzf-server --help The --help documentation says that the CLI arguments are parsed with regex. The regex is Perl, so I had to swap my standard Linux regex for Perl.
Requests
These are just what I saw and don't need to be implemented since there is a workaround. Documenting them for completeness.
- Update the
--help documentation to call out it is Perl regex.
- Please add the
kubectl-fzf-server arguments to the documentation.
- Change how
--watch-namespaces works to exclude all other namespaces.
#TLDR:
--watch-namespacesdoes not exclude all other namespaces. It still watches all namespaces.Details
Good day,
Thanks for such a useful tool for making Kubernetes administration faster!
Got tired of the slow auto complete in
kubectl. Installedkubectl-fzfbut I use a private cluster that requires a VPN. The VPN is billed per data transferred so I did not want to monitor all namespaces and resources. I didn't deploy thekubectl-fzf-serverserver to the cluster, this is probably the best solution for my billing issues.Issue
I started with:
kubectl-fzf-server --watch-namespaces e2e-testingBut the output was unexpected, it was still watching all namespaces!
Workaround
I was able to work around this issue by using the
--exclude-namespacesand a negative Perl regex,'/^(e2e-testing)/'For example:
kubectl-fzf-server --watch-namespaces 'e2e-testing' --exclude-namespaces '/^(e2e-testing)/'Which results in the following output and works well:
Documentation
At first, I thought I would have to recompile
kubectl-fzf-serversince there was no documentation of CLI arguments. But I did find them tracing though the code and was able to get more details withkubectl-fzf-server --helpThe--helpdocumentation says that the CLI arguments are parsed with regex. The regex is Perl, so I had to swap my standard Linux regex for Perl.Requests
These are just what I saw and don't need to be implemented since there is a workaround. Documenting them for completeness.
--helpdocumentation to call out it is Perl regex.kubectl-fzf-serverarguments to the documentation.--watch-namespacesworks to exclude all other namespaces.