Skip to content

resources/home: "equipped with" sums allocatable across k3d nodes — reports 2× the machine (24 CPU · 13.4 GiB on a 12-core host) #399

Description

@LukasWodka

Symptom

On a default k3d install (1 server + 1 agent — two kubernetes "nodes" that are containers on the same physical machine), tracebloc resources reports double the real capacity:

Your secure environment is equipped with: 24 CPU · 13.4 GiB ← machine has 12 logical CPUs, node allocatable ~6.7 GiB

The resources set wizard header on the same machine says 2 of 12 cores / 8 of 6.7 GiB — so two adjacent surfaces disagree by exactly 2×.

Root cause

internal/resources/resources.go:67-92MachineCapacitysums Status.Allocatable across every Ready node (only a Ready filter, no dedup/role awareness):

forname, qty:=rangen.Status.Allocatable {
case corev1.ResourceCPU: addInto(&m.CPU, qty)
case corev1.ResourceMemory: addInto(&m.Mem, qty)

The package comment (resources.go:9-10, 64-66) assumes the installer path is single-node — but the default k3d topology is server-0 + agent-0, each reporting the full Docker-VM capacity, so one machine is counted twice. Print site: internal/cli/resources.go:132 (data via :108-111). The home screen does the identical sum in sumCapacity (internal/cli/home.go:597-621).

Everything scheduling-relevant already uses the correct per-node view: the wizard uses LargestReadyNode (resources_set.go:182), and doctor's fit check is explicitly per-node (internal/doctor/doctor.go:595-605, "a pod gets ALL its requested resources from ONE node"). Only the two display surfaces sum.

Fix

Use the largest-Ready-node view for the "equipped with" headline (reuse resources.LargestReadyNode) in both resources.go:132 and home.go:597-621 — that's what "this machine" can actually give a training run. If multi-node (non-k3d) clusters should still see totals, present it explicitly as "across N nodes: …" rather than as the machine's size.

Acceptance

  • On a default k3d install, resources, resources set, doctor, and home all quote the same single-node capacity.
  • Test with a fake 2-node (identical allocatable) node list asserting the headline is 1× (regression for the k3d double-count).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions