ScaleParseError when micro cpu usage is returned
ceusebi-eb opened this issue · comments
When running with option -u
some pods may be using less than a mili cpu which is reported with a u
symbol.
Command fails with error:
{"v":0,"name":"kubectl_view_allocations","msg":"kubectl_view_allocations","level":40,"hostname":"ceusebi-30206","pid":38976,"time":"2022-07-31T20:21:47.71891Z","target":"kubectl_view_allocations","line":666,"file":"src/lib.rs","err":"ResourceQtyParseError { location: Location { node_name: Some(\"NODE_NAME\"), namespace: Some(\"NAMESPACE\"), pod_name: Some(\"POD\") }, qualifier: Utilization, kind: \"cpu\", input: \"608u\", source: ScaleParseError(\"u\") }"}
Version:
~ kubectl-view-allocations --version
kubectl-view-allocations 0.15.0
Cluster's Metrics server version: k8s.gcr.io/metrics-server/metrics-server:v0.5.0
Metrics server extra args:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
- --authorization-always-allow-paths=/livez,/readyz
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-use-node-status-port
- --metric-resolution=15s
Looking at the code it may be related to this section.
https://sourcegraph.com/github.com/davidB/kubectl-view-allocations/-/blob/src/qty.rs?L30
I can't offer a PR for this because i've never used rust
Hi @davidB, could you fix it? Thanks
I'll add support for u
and μ
(micro) as 10 pow -6, but the value will be truncated to 0m, like currently for n
(nano).
Great