feat(workloadmeta): collect GPU topology data in the Cluster Agent #61824
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #61824"
general
weight: 0.35
gjulianm
What does this PR do?
Adds to the Cluster Agent's workloadmeta the data the upcoming
gpu_topologycheck needs to compute thegpu.scheduling.topology.metrics. That check reports how GPUs are used across the Kueue or KAI Scheduler topology levels: block, rack, host. Everything is behind a newgpu_topology.enabledsetting (defaultfalse). It requirescluster_agent.kueue.enabledorcluster_agent.kai_scheduler.enabled(or both).KubernetesKueueTopologykind. It holds the cluster-scoped KueueTopologyand its orderedspec.levels[].nodeLabel, read on whichever served version the API server picks (v1alpha1/v1beta1/v1beta2). The kind isn't streamed to node Agents and the tagger ignores it.KubernetesKAITopologykind. It holds the cluster-scoped KAI SchedulerTopology(kai.scheduler/v1alpha1, a different API group from the KAI PodGroups) and its orderedspec.levels[].nodeLabel. It's collected whencluster_agent.kai_scheduler.enabledis on, with the same RBAC probe as the Kueue Topology. Like the Kueue kind, it isn't streamed to node Agents and the tagger ignores it.KubernetesKueueResourceFlavor: addsTopologyNameandTolerations.KubernetesNode: addsGPUCapacityandGPUAllocatableper GPU device plugin resource (nvidia.com/gpu,nvidia.com/gpu.shared,amd.com/gpu,gpu.intel.com/i915,gpu.intel.com/xe), plusMIGCapacityandTaints. Keys are kept when the count is 0. The resource list is shared inpkg/util/gpu.ContainerResources.GPURequestsper GPU resource, for containers and init containers. A missing request falls back to the limit. It is only parsed whengpu_topologyis on and leader election is enabled.pkg/clusteragent/gputopologygate:Synced()tells the check when the node, pod, ResourceFlavor and Topology stores (Kueue and KAI) have finished their first LIST. Until then every node would look free. The Topology stores are only in the gate, not in the Cluster Agent readiness check; the ResourceFlavor store stays in readiness, as on main.gpu_topology.assumed_tolerations(default[]) andgpu_topology.kai.node_pool_label(defaultkai.scheduler/node-pool, KAI'snodePoolLabelKey) will be read by the check. With KAI, the check reports per (KAI Topology, node pool).<details>
<summary>Functional changes</summary>
| Before | After |
| --- | --- |
| — |
gpu_topology.enabled: truewith Kueue on: Kueue Topologies are collected; flavors also keeptopologyName/tolerations; nodes keep GPU capacity/allocatable/taints; pods keep per-container GPU requests || Missing RBAC on
resourceflavorswithgpu_topologyon: the flavor store retried forever and blocked readiness | One warning, the store is skipped, readiness isn't blocked. Other errors are still retried || — |
gpu_topology.enabled: truewith KAI on: KAI Topologies are collected; nodes and pods get the same GPU data as with Kueue. With Kueue off, no Kueue GPU topology store starts || — | Missing RBAC on
topologies.kai.scheduler, or no KAI Topology CRD: one warning or info, the store is skipped and the check doesn't wait for it || — | Kueue or KAI Topologies that can't be listed (e.g. broken conversion webhook) only hold back the
gpu_topologycheck, not the Cluster Agent readiness || — |
gpu_topology.enabledwithoutcluster_agent.kueue.enabledorcluster_agent.kai_scheduler.enabled, or withoutleader_election: one warning at startup, no GPU request parsing |Unchanged: with
gpu_topologyoff (the default), pod entities, Kueue and KAI collection and readiness, the kube metadata stream and the proto are the same as before.</details>
Motivation
Step 1 of the topology-aware GPU metrics (design:
gpu.scheduling.topology., data layer in DCA workloadmeta). The check itself, and its release note, come in a follow-up PR.Pods: since #61355 the pod store always runs when
cluster_agent.kueue.enabledis on (KAI also needs pods at startup), andgpu_topologyrequires one of them. So this PR adds no pod store of its own. It doesn't start one on the leader only, and it doesn't use a field selector or a GPU-only filter. It only adds the GPU requests on top of the init containers that #61395 collects.Leader: the check will use the same leader rule as
job_scheduler_events(#61005). Withleader_election: falseno replica is the leader, and nothing is reported. This PR only logs the warning and skips the GPU request parsing in that case.Describe how you validated your changes
Unit tests for every parser change (Kueue and KAI Topology levels, flavor topologyName/tolerations, node GPU maps/MIG/taints, per-resource pod GPU requests for both the minimal and the typed parser, option off = unchanged), the RBAC probe for Kueue and KAI (served version, missing CRD, forbidden, temporary error), the Kueue and KAI topology stores, the gate (synced only after the KAI Topology store syncs), KAI-only and Kueue+KAI gating, the tagger,
assumed_tolerationsparsing from YAML and env var, and thenode_pool_labeldefault and env var.Additional Notes
topologies.kueue.x-k8s.io(Kueue) andtopologies.kai.scheduler(KAI).resourceflavorsandpodsare already granted when Kueue is enabled, andpodswhen KAI is.nvidia.com/gpu.sharedcounts replicas, not GPUs. The check must report such nodes as unsupported and never add them to GPU capacity.