Closed JobberRT closed 1 year ago
Thanks for reporting this! I've been pretty underwater recently but if anyone has time to fix this I'll try to review a PR ASAP.
Please let me know if I can work on this.
Hey @KR411-prog, thanks for volunteering! Appreciate any help with this.
When I checked the main branch, I dont see this if else condition anymore. I see switch case statement with also default condition check. https://github.com/robscott/kube-capacity/blob/807764563371f82047bed8f55f5a037aae3e1298/pkg/capacity/resources.go#L395-L409
I also dont find wrong unit in cpu for 0% usage now.
Please let me know if this issue reported is still valid.
@KR411-prog @robscott Sorry guys, I was late. Did this issue no longer exist? I've not using KC
for a long time.
@JobberRT I think the issue is no longer valid as the main branch does not seem to have the code anymore.
Thanks @JobberRT and @KR411-prog, will close this out.
Here
kc
set the resources unit: https://github.com/robscott/kube-capacity/blob/9557a2857fa949de037858bb19b8f37580f16470/pkg/capacity/resources.go#L103-L112And if the
cpu
ormemory
unit is a blank string(0% usage for example), this code will do the wrong judgement(all the judgement aboutFormat
, here just a example): https://github.com/robscott/kube-capacity/blob/9557a2857fa949de037858bb19b8f37580f16470/pkg/capacity/resources.go#L366-L372Because the value of
cpu
ormemory
is a blank string, so it's type won't beresource.DecimalSI
, and it will always do theelse
code block. And of couse its calculate progress will be wrong too since theelse
code block will callformatTomegiBytes
and the unit is not correct: https://github.com/robscott/kube-capacity/blob/9557a2857fa949de037858bb19b8f37580f16470/pkg/capacity/resources.go#L387-L393The Wrong output will be like(those red ones):
I will try to fix it and provide a PR, but my skills are not good, will do my best