Skip to content

karpenter: NodePool CPU is parsed with parseInt, so milli-core quantities read 1000x too high #1243

Description

@RajPrakash681

Description

The NodePool list and details views read CPU with parseInt, but status.resources.cpu and spec.limits.cpu are Kubernetes resource quantities, so they can carry a suffix.

parseInt('1750m') stops at the first non-digit and returns 1750. The suffix is dropped, so 1.75 cores is displayed and charted as 1750 cores — a thousand times too large.

Memory in the same two files is already handled correctly: it goes through parseRam() and is formatted with getResourceStr(). Only CPU uses parseInt.

Karpenter itself reports these values in milli-cores whenever the amount is not a whole number of cores, which is the common case for a NodePool that has scaled up partially.

Affected code

  • karpenter/src/NodePool/List.tsx lines 76-77 (getValue) and 82-83 (render)
  • karpenter/src/NodePool/Details.tsx lines 94-95 (extraInfo)

Steps to reproduce

  1. Install Karpenter and let a NodePool provision nodes so that status.resources.cpu is reported in milli-cores, for example 1750m, with spec.limits.cpu set to 8.
  2. Open Karpenter → NodePools.

Current behaviour

The CPU column reads 1750/8, and the percentage bar is driven by used = 1750 against total = 8, so it pins at full with a tooltip claiming 21875%.

The details view shows 1750 of 8 for the same NodePool.

Expected behaviour

The CPU column reads 1.75/8, and the bar shows roughly 22%. The details view shows 1.75 of 8.

Notes

kubeflow/src/components/common/notebookUtils.ts already has parseCpuQuantity, which converts n, u, m and plain suffixes to cores and is unit tested. The same conversion is what the karpenter plugin needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions