Skip to content

kubernetes-nodes emits resources.cpu straight into a uint32 cores field and decides precedence from the raw string #4150

Closed

Description

packages/apps/kubernetes-nodes/templates/nodegroup.yaml reads resources.cpu twice, and both readings take the value as written rather than as it will land in the object.

Line 136 renders cores: {{ .group.resources.cpu }} with no coercion. domain.cpu.cores is a uint32 in KubeVirt's API, and the chart's schema types resources.cpu with the quantity grammar, so a nodegroup written with resources.cpu: 500m emits cores: 500m and the API server refuses the VirtualMachine outright.

Line 69 compounds it. $sizedByResources is and .group.resources .group.resources.cpu .group.resources.memory, which tests the raw string for truthiness, so 500m counts as sizing. The instancetype matcher is dropped on that basis, and what remains is a VM with neither a matcher nor a usable core count. Had the check read what the template actually emits, 500m would not have counted and the matcher would have stayed.

Both are the same underlying reading: the value the operator typed is not the value the object receives, and a quantity string is exactly where those two diverge.

The fix has a shape already used elsewhere in the tree for this field family: coerce through the integer conversion before emitting, and decide precedence from what the conversion produced rather than from the source string. packages/apps/vm-instance is being changed to do that for the same pair of concerns, so the reasoning and the test shapes can be copied rather than invented.

Worth handling in the same pass: resources.memory and any other quantity-typed field this template emits into an integer position, since the defect is a property of the type rather than of cpu.

Activity

  1. added
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release
    and removed
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
  2. added a commit that references this issue on Oct 3, 2026
    11910e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kubernetesIssues or PRs related to the tenant Kubernetes appkind/bugCategorizes issue or PR as related to a bugpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releasetriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions