davidB / kubectl-view-allocations

kubectl plugin to list allocations (cpu, memory, gpu,... X utilization, requested, limit, allocatable,...)

Home Page:https://crates.io/crates/kubectl-view-allocations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider support stacked kubeconfigs

Dentrax opened this issue · comments

If we set multiple KUBECONFIG in our $KUBECONFIG env flag, kubectl-view-allocations could not understand and throws an exception:

$ export KUBECONFIG=$KUBECONFIG:$HOME/.kube/config:$HOME/.kube/config-foo:$HOME/.kube/config-bar

$ kubectl view-allocations -n my-namespace

[2021-01-28T14:42:09Z ERROR kubectl_view_allocations] failed
    cli: CliOpts { namespace: Some("my-namespace"), show_zero: false, resource_name: [], group_by: [resource, node, pod], output: table }
    error: Error loading kubeconfig: Failed to infer config.. cluster env: (Error loading kubeconfig: Unable to load in cluster config, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined), kubeconfig: (Error loading kubeconfig: Failed to read '":/Users/furkan/.kube/config:/Users/furkan/.kube/foo:/Users/furkan/.kube/bar"': No such file or directory (os error 2))
    
Caused by:
0: Failed to infer config.. cluster env: '"SAME HERE"'
1: Error loading kubeconfig: Failed to read '"SAME HERE"'
2: Failed to read '"SAME HERE"'
3: No such file or directory (os error 2)

I think it should recognize that if given input is stacked file path.

Thanks for reporting,
It's a known limitation/issue of the underlying lib used to communicate with k8s:

kube-rs/kube#132

Edit: same response to the issue you reported at edrevo/suspicious-pods#7

We should have it supported in the next release. kube-rs/kube#411

kubectl-view-allocations 0.12.x should work with stacked valid config. (error are raised if config file could not be read/parsed until find the target context).

Thanks @kazk