Closed Dentrax closed 3 years ago
Thanks for raising this issue @Dentrax! This is a very confusing part of kube-capacity and I think I should probably add support for a proper --namespace
flag and repurpose the shorthand -n
to map to it. As it is now, -n
maps to --namespace-labels
. If you label a namespace or set of namespaces (kubectl label ns kube-system test=foo
), you can then query them like this:
kube-capacity -n test=foo --pods --util
If the selector does not match anything, kube-capacity shows the unfortunate output you're seeing above. Although that's a bug, it seems like the biggest priority should be to add support for a --namespace
label to work as expected here. Unfortunately I'm pretty underwater right now so not sure how soon I'll be able to get to this. If anyone happens to have any free cycles, contributions are always appreciated :)
Thanks for the detailed explanation! It is a bit off to understand that we have to label specific namespace to do some filtering stuff, as you said. So are understanding differences between --namespace
and --namespace-labels
. Additionally to -n
, --namespace-labels
is another cool filtering feature, but we can handle that in another shorthand flag, i.e., -l
, instead of replacing -n
's default behavior. :)
$ kubectl resource-capacity --pods
shows too many pods, so I want to filter those with a givennamespace-labels
argument. If you try this:$ kubectl resource-capacity --pods -n kube-system
, it shows all empty for some reason. What I expect is that it should gather the exact same values in the previous run and should list only the given namespace. But It prints*
in the NAMESPACE column, notkube-system
.