Repository navigation
Description
Split from #7437.
Problem The GPU placement code names the node label nvidia.com/gpu.architecture through CONST_K8S_GPU_ARCHITECTURE_LABEL (src/devops_cli/k8s/gpu_thresholds.py, src/devops_cli/k8s/gpu_placement.py). The homelab NodeFeatureRule copies GPU Feature Discovery's nvidia.com/gpu.family into nvidia.com/gpu.architecture only because this code names that key. When the code reads the family label too, the environment can drop the copied label. ## Why this part is deferred The earlier proposal of #7437 asked a test to pass a node label map to _newest_architecture. That is wrong. _newest_architecture(template: dict[str, Any]) -> str at src/devops_cli/k8s/gpu_thresholds.py:116 takes a DaemonSet manifest template and reads its node selector terms. The work also needs a NodeFeatureRule and a manifest change in the homelab environment tree, which is not this repository. The warning fix of #7437 ships on its own. ## Acceptance criteria - The GPU threshold code MUST read nvidia.com/gpu.family from the node selector terms of a DaemonSet template when the template holds no nvidia.com/gpu.architecture term. - WHEN A test passes a DaemonSet template whose node selector terms hold one nvidia.com/gpu.family match expression with the value ampere, and no nvidia.com/gpu.architecture term. - THEN _newest_architecture returns ampere. - The GPU threshold code MUST keep the nvidia.com/gpu.architecture term first when a template holds both keys. - WHEN A test passes a DaemonSet template whose node selector terms hold both keys with different values. - THEN _newest_architecture returns the nvidia.com/gpu.architecture value. - The check in src/devops_cli/k8s/gpu_placement.py MUST keep comparing DaemonSet match expressions against node labels as Kubernetes does. - WHEN A node holds only nvidia.com/gpu.family and the DaemonSet requires nvidia.com/gpu.architecture. - THEN the placement report states that the node does not accept the DaemonSet.
Proposed design
Problem statement
The GPU threshold code reads only nvidia.com/gpu.architecture from DaemonSet node selector terms. The homelab environment copies nvidia.com/gpu.family into that label only because of this code. This change reads the family label as a fallback, keeps the architecture label first, and leaves placement matching exact.
Acceptance criteria
Requirement: Family label fallback
The GPU threshold code SHALL read nvidia.com/gpu.family from the node selector terms of a DaemonSet template when the template holds no nvidia.com/gpu.architecture term.
Scenario: Family-only template
- WHEN A test passes a DaemonSet template whose node selector terms hold one
nvidia.com/gpu.familymatch expression with the valueampere, and nonvidia.com/gpu.architectureterm. - THEN
_newest_architecturereturnsampere.
Requirement: Architecture label precedence
The GPU threshold code MUST keep the nvidia.com/gpu.architecture term first when a template holds both keys.
Scenario: Both labels present
- WHEN A test passes a DaemonSet template whose node selector terms hold both keys with different values.
- THEN
_newest_architecturereturns thenvidia.com/gpu.architecturevalue.
Requirement: Exact placement matching
The GPU placement check MUST compare DaemonSet match expressions against node labels by exact label key, as Kubernetes does.
Scenario: Family label does not satisfy architecture requirement
- WHEN A test passes a GPU node labelled
nvidia.com/gpu.family=ampereandnvidia.com/gpu.total-vram=24, and a tier whose required term namesnvidia.com/gpu.architecture=ampereandnvidia.com/gpu.total-vram=24. - THEN
placement_warningsreturns theMESSAGES.k8s.gpu_node_architecture_not_acceptedwarning for that node.
Existing Tool Considered
No alternatives check has run. No open tool or library covers this need: NVIDIA GPU Feature Discovery publishes nvidia.com/gpu.family, but it does not read DaemonSet templates or render GPU thresholds. The change extends the existing gpu_thresholds.py functions. Written cost: about 2,000 tokens to write and test, about 1,000 tokens for each later change, and less than 1 hour of elapsed time.
Key questions
- What input does
_newest_architecturetake, and which label does it read today?: It takes a DaemonSet manifest template. It readsspec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTermsand selects the newest value ofnvidia.com/gpu.architecturefrommatchExpressions. [sources: src/devops_cli/k8s/gpu_thresholds.py:116, src/devops_cli/config/constants.py:1183] - When a template holds both
nvidia.com/gpu.architectureandnvidia.com/gpu.family, which label wins?: The architecture label wins. The code reads architecture values when any architecture match expression exists. It reads family values only when no architecture expression exists. (best practice) [sources: src/devops_cli/k8s/gpu_thresholds.py:116, src/devops_cli/config/constants.py:1183]- Chosen: Architecture first, family fallback. This keeps the current label first and adds family only when architecture is absent.
- Rejected: Family first, architecture fallback. This changes the current priority and breaks the issue requirement.
- Rejected: Merge both label value sets. This can select a family value over an architecture value and breaks the issue requirement.
- Should
gpu_placement.pytreatnvidia.com/gpu.familyasnvidia.com/gpu.architecturewhen it checks a node?: No. Kubernetes matches label keys exactly. The placement check keeps exact matching, and the family fallback stays in the threshold render. (best practice) [sources: src/devops_cli/k8s/gpu_placement.py, src/devops_cli/k8s/gpu_thresholds.py:116]- Chosen: Keep exact label matching. This matches Kubernetes node selector behavior and the issue requirement.
- Rejected: Alias family to architecture in placement. This reports a node as accepted when Kubernetes does not schedule the pod.
- Where does the NodeFeatureRule and manifest change live?: They live in the homelab environment tree in dan-petty/homelab, not in this repository. This issue changes only the devops-cli code. [sources: CONTEXT.md]
- Should the family label key be a named constant?: Yes. Add
CONST_K8S_GPU_FAMILY_LABEL = "nvidia.com/gpu.family"next toCONST_K8S_GPU_ARCHITECTURE_LABEL, and import it ingpu_thresholds.py. (best practice) [sources: src/devops_cli/config/constants.py:1183, src/devops_cli/k8s/gpu_thresholds.py:116]- Chosen: Named constant. It keeps one source for label keys and avoids a duplicated literal.
- Rejected: Literal in the function. It hides the label key and makes later changes harder.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 28, 2026
Both deal with GPU node labeling in k8s, but #124 adds new introspection commands while this candidate fixes existing threshold code to read an additional label.devops-cli-service commentedon Nov 28, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
chore(main): release 0.247.0 (#7752)
devops-cli-service commentedon Nov 29, 2026
Released in v0.247.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.247.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:17 UTC