← Back to Pull requests

feat [metadata-collector]: map DRA gpu pods for partial drain #1930

Closed
unknown closed this pull request without merging on Oct 01, 2026 11:00 UTC
View on GitHub
unknown unknown commented on Sep 29, 2026 09:19 UTC
Author

Summary

metadata-collector annotates every GPU pod with the UUIDs of the GPUs it holds (dgxc.nvidia.com/devices), and node-drainer uses that annotation to evict only the pods on a faulty GPU during a partial drain. The mapper reads the kubelet PodResources response but only walks container.devices, which device plugins populate with UUIDs.

In GPU Operator 26.7 GPUCluster mode there is no device plugin. GPUs are allocated through DRA ResourceClaims and the kubelet reports them in container.dynamic_resources as driver gpu.nvidia.com, a pool name and a device name (gpu-0 to gpu-7), not as UUIDs. The mapper never read that field, so no GPU pod on a GPUCluster node received the annotation and every partial drain degraded to a full node drain.

Fixes NVIDIA/NVSentinel#1865.

Decision

Extend the mapper to also read dynamic_resources from the PodResources response and resolve DRA device names to GPU UUIDs locally through NVML, with no API server reads from the DaemonSet.

The NVIDIA DRA driver names each GPU gpu-<minor>, where minor is the /dev/nvidiaN number, a choice it documents as deliberate because the minor is fixed for as long as the GPU stays on the bus. The collector already runs NVML on every node, so for each claim resource from driver gpu.nvidia.com it reads every GPU's minor number and UUID, formats the minor with the driver's own gpu-%d pattern, and compares that to the allocated name. Anything the driver would not have produced fails closed. NVML is opened for one short read per poll, only when a DRA allocation is present, and closed again, so the collector never holds the driver open between polls and does not block driver reloads or GPU resets. A GPU that fails its own NVML calls is skipped so the healthy GPUs still resolve.

Resolved UUIDs are written to the existing annotation under the key gpu.nvidia.com, which is added to the shared resource-name list so node-drainer's partial-drain matching needs no code change. An allocation whose name does not resolve is skipped and picked up on the next poll. No RBAC or chart change is required.

Testing

Verified live on azr dev cluster running Kubernetes 1.36.3, 4 nodes with 8x H100.

1. GPU Operator 26.3.3, ClusterPolicy mode (device plugin)

Regression check for the refactored device-plugin path. Pod plugin-gpu-test requested nvidia.com/gpu: 2.

Annotations:  dgxc.nvidia.com/devices:
                {"devices":{"nvidia.com/gpu":["GPU-7c48ff95-54b8-2870-dedb-9dcbc3649b24","GPU-b77304cd-0003-67bd-9616-e72fa6685520"]}}
Status:       Running

{"level":"INFO","msg":"Updating devices annotation for pod","podKey":"default/plugin-gpu-test","annotation":"{\"devices\":{\"nvidia.com/gpu\":[\"GPU-7c48ff95-…\",\"GPU-b77304cd-…\"]}}"}


Same key, same sorted-UUID shape and one patch, identical to the behaviour of the shipping v1.20.0 collector measured on the same cluster beforehand.

2. GPU Operator 26.7.0, ClusterPolicy mode (device plugin, driver 595)

Same test on the 26.7 operand stack. Pod plugin-gpu-test requested nvidia.com/gpu: 2.

Annotations:  dgxc.nvidia.com/devices:
                {"devices":{"nvidia.com/gpu":["GPU-8c24c993-4dbb-7c73-a13d-5077524ebcf5","GPU-f0c30c97-0ab8-d3b3-6967-88806cf2ce81"]}}
Status:       Running

{"level":"INFO","msg":"Updating devices annotation for pod","podKey":"default/plugin-gpu-test","annotation":"{\"devices\":{\"nvidia.com/gpu\":[\"GPU-8c24c993-…\",\"GPU-f0c30c97-…\"]}}"}


gpu_metadata.json now carries the new minor_number field alongside the UUID for every GPU, for example:

{ "gpu_id": 7, "uuid": "GPU-8c24c993-4dbb-7c73-a13d-5077524ebcf5", "pci_address": "000c:00:00.0", "minor_number": 7, ... }
{ "gpu_id": 4, "uuid": "GPU-f0c30c97-0ab8-d3b3-6967-88806cf2ce81", "pci_address": "0009:00:00.0", "minor_number": 4, ... }


Each collector pod logs Initializing NVML exactly once, confirming the mapper no longer opens a second NVML session. No warnings on any of the six nodes.

3. GPU Operator 26.7.0, GPUCluster mode (DRA)

The case this PR exists for. Pod dra-gpu-test requested two GPUs through a ResourceClaimTemplate with deviceClassName: gpu.nvidia.com. The scheduler allocated:

Device: gpu-0   Driver: gpu.nvidia.com   Pool: aks-gpu-24710450-vmss000014
Device: gpu-1   Driver: gpu.nvidia.com   Pool: aks-gpu-24710450-vmss000014


The collector resolved the device names through the minor numbers recorded in gpu_metadata.json:

{ "gpu_id": 0, "uuid": "GPU-5ee40b55-b285-a17f-9a82-3b7e193fdcde", "pci_address": "0001:00:00.0", "minor_number": 0, ... }
{ "gpu_id": 1, "uuid": "GPU-fb78fbe7-9040-490f-8053-4856c6f9e444", "pci_address": "0002:00:00.0", "minor_number": 1, ... }

and annotated the pod under the gpu.nvidia.com key:

{"time":"2026-10-01T05:23:29.150441674Z","level":"INFO","msg":"Updating devices annotation for pod","module":"metadata-collector","version":"dev","podKey":"default/dra-gpu-test","annotation":"{\"devices\":{\"gpu.nvidia.com\":[\"GPU-5ee40b55-b285-a17f-9a82-3b7e193fdcde\",\"GPU-fb78fbe7-9040-490f-8053-4856c6f9e444\"]}}"}

Annotations:  dgxc.nvidia.com/devices:
                {"devices":{"gpu.nvidia.com":["GPU-5ee40b55-b285-a17f-9a82-3b7e193fdcde","GPU-fb78fbe7-9040-490f-8053-4856c6f9e444"]}}
Status:       Running

The two UUIDs match gpu-0 and gpu-1 in the metadata and the pod's own nvidia-smi -L. No API server reads beyond the existing pod patch.

4. Partial drain in GPUCluster mode

End-to-end check that node-drainer acts on the new annotation. node-drainer was built from this branch, partialDrainEnabled: true, drain mode Immediate. Two DRA pods on node vmss000014:

Pod | Devices | Annotation
-- | -- | --
dra-gpu-test | gpu-0, gpu-1 | "GPU-41c8b08b-ffe9-af57-2f20-e893ead0a707","GPU-fb78fbe7-9040-490f-8053-4856c6f9e444"
dra-gpu-test-b | gpu-2 | "GPU-41c8b08b-ffe9-af57-2f20-e893ead0a707"

An XID 119 was injected into the kernel log for PCI 0002:00:00, the GPU held only by dra-gpu-test. The syslog health monitor resolved it to the UUID via gpu_metadata.json:

SysLogsXIDError True SysLogsXIDErrorIsNotHealthy ErrorCode:119 PCI:0002:00:00 GPU_UUID:GPU-fb78fbe7-9040-490f-8053-4856c6f9e444 ... Recommended Action=COMPONENT_RESET

node-drainer matched that UUID against the gpu.nvidia.com key and selected only the affected pod:

{"time":"2026-10-01T06:18:30.59084973Z","level":"INFO","msg":"Filtering pods using entity for a partial node drain","module":"node-drainer","version":"dev","nodeName":"aks-gpu-24710450-vmss000014","entityType":"GPU_UUID","entityValue":"GPU-fb78fbe7-9040-490f-8053-4856c6f9e444"}
{"time":"2026-10-01T06:18:30.590875719Z","level":"INFO","msg":"Pod is eligible to be drained since it's using impacted entity","module":"node-drainer","version":"dev","podName":"dra-gpu-test","nodeName":"aks-gpu-24710450-vmss000014","entityType":"GPU_UUID","entityValue":"GPU-fb78fbe7-9040-490f-8053-4856c6f9e444"}
{"time":"2026-10-01T06:18:30.610437989Z","level":"INFO","msg":"Pod eviction initiated for namespace on node","module":"node-

{"time":"2026-10-01T06:19:30.659301989Z","level":"INFO","msg":"Labeling node","module":"node-drainer","version":"dev","node":"aks-gpu-24710450-vmss000014","from":"draining","to":"drain-succeeded"}
{"time":"2026-10-01T06:19:30.751340198Z","level":"INFO","msg":"Label updated successfully for node","module":"node-drainer","version":"dev","label":"dgxc.nvidia.com/nvsentinel-state","node":"aks-gpu-24710450-vmss000014"}
{"time":"2026-10-01T06:19:30.756269333Z","level":"INFO","msg":"Node drainer evictionDuration is","module":"node-drainer","version":"dev","evictionDuration":70.945945122}
{"time":"2026-10-01T06:19:30.756300399Z","level":"INFO","msg":"Health event status has been updated","module":"node-drainer","version":"dev","documentID":"6abdfb2b3044fed0ce4aeeb9","evictionStatus":"Succeeded","drainScope":"partial"}

Result: dra-gpu-test was evicted within 71 seconds. dra-gpu-test-b on gpu-2 was never considered and stayed Running on the node:

Name:         dra-gpu-test-b
Node:         aks-gpu-24710450-vmss000014/10.1.2.19
Annotations:  dgxc.nvidia.com/devices: {"devices":{"gpu.nvidia.com":["GPU-41c8b08b-ffe9-af57-2f20-e893ead0a707"]}}
Status:       Running

The DCGM-DRA and metadata-collector pods on the node, which hold admin-access claims covering all eight GPUs, were untouched because their namespaces are excluded from draining.

<!-- Brief description of your changes -->

Type of Change


  • 🐛 Bug fix

  • ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • Tests pass locally

  • Manual testing completed

  • No breaking changes (or documented)
  • Checklist


  • Self-review completed

  • Documentation updated (if needed)

  • Ready for review
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Summary

    New Features
    GPU metadata collection now supports NVIDIA GPUs allocated through Kubernetes Dynamic Resource Allocation (DRA), mapping DRA device names to GPU UUIDs.
    GPU annotations now include DRA allocations under the gpu.nvidia.com resource key. Unresolved device names are not included.
    Documentation
    * Clarified how device-plugin and DRA GPU allocations are recorded, including the Kubernetes feature gate required for DRA allocation reporting.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: tanishagoyal2 Review duration: 2980m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1930"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%