Skip to content

ComputeDomains: Allow shareable channels within a ComputeDomain and multiple ComputeDomains per node - #1576

Open
shivamerla wants to merge 10 commits into
kubernetes-sigs:mainfrom
shivamerla:cd_consumable_shares
Open

shivamerla wants to merge 10 commits into
kubernetes-sigs:mainfrom
shivamerla:cd_consumable_shares

Conversation

@shivamerla

@shivamerla shivamerla commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds IMEX channel reservations per ComputeDomain, behind the new alpha ComputeDomainChannelReservations feature gate. Today every ComputeDomain injects channel 0, and only one workload pod per node can hold it. With this PR a ComputeDomain can list several ResourceClaimTemplates in spec.channels, each with its own channel. Workloads on different templates share the ComputeDomain's nodes and IMEX daemon but are isolated from each other. Pods on the same template get the same channel across an NVLink clique and can share a node.

The kubelet plugin publishes one shared imex-channel device per node. The controller assigns the channel when it admits the claim through a DRA binding condition, and writes it into the claim status for the plugin to inject. Channels are allocated per clique and freed with their last claim.

With imex.daemonLifecycle=perComputeDomain a node still belongs to one ComputeDomain at a time. The controller labels the node on the first admitted claim, and the plugin advertises the owner as a DeviceTaint so the scheduler skips the node for other ComputeDomains. With imex.daemonLifecycle=static or hostManaged, ComputeDomains can share nodes, isolated by their channels.

Enabling the gate doesn't touch existing ComputeDomains. They keep their templates and stay on channel 0. Only new ComputeDomains get their own channels, and the controller and plugins can be upgraded in any order.

Admission costs one claim status write per pod, and the controller handles roughly 50-100 pods per second.

Which issue(s) this PR is related to:

Fixes #1574 #353 and builds the foundation for static IMEX daemons: #920

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add the alpha ComputeDomainChannelReservations feature gate. A ComputeDomain can list several ResourceClaimTemplates in spec.channels, each with its own IMEX channel, and pods using the same template can share a node. Existing ComputeDomains stay on channel 0. Requires Kubernetes 1.36+ with DRAConsumableCapacity and DRADeviceBindingConditions.

Additional documentation (design docs, usage docs, etc.):

site/content/contribute/proposals/0001-computedomain-channel-reservations.md
site/content/docs/concepts/compute-domains.md#channel-reservations
site/content/docs/guides/compute-domain-workloads.md (Run several workload pods per node, Use several claim templates per ComputeDomain)
site/content/docs/reference/helm-values.md (imex.daemonLifecycle, imex.maxChannels, controller.kubeAPI)
site/content/docs/reference/feature-gates.md

Checklist

  • make check test passes locally
  • make check-generate passes if api/ changed (CRDs, deepcopy, informers, listers, clientset)
  • make check-modules passes if go.mod / go.sum changed
  • Tests added or updated for the change
  • Helm chart (deployments/helm) updated if flags, RBAC, or defaults changed

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 19, 2026
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

👷 Deploy request for dra-driver-nvidia-gpu pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 06c2e9f

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shivamerla

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested review from klueska and shengnuo October 19, 2026 17:39
@shivamerla
shivamerla marked this pull request as draft October 19, 2026 17:39
@kubernetes-prow kubernetes-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 19, 2026
@shivamerla
shivamerla force-pushed the cd_consumable_shares branch 2 times, most recently from f5d97e1 to 98798ed Compare October 19, 2026 18:04
@shivamerla

Copy link
Copy Markdown
Contributor Author

Regression tests:

With both ConsumableShares and ComputeDomainChannelReservations disabled:

--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1792527619
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort tests/bats/test_basics.bats tests/bats/test_cd_imex_chan_inject.bats tests/bats/test_cd_mnnvl_workload.bats tests/bats/test_cd_misc.bats tests/bats/test_cd_logging.bats tests/bats/test_cd_failover.bats tests/bats/test_cd_updowngrade.bats tests/bats/test_cd_leader_election.bats
test_basics.bats
 ✓ basics: test VERSION_W_COMMIT, VERSION_STAGING_CHART, VERSION [84]
 ✓ basics: confirm no kubelet plugin pods running [74]
 ✓ basics: GPU Operator installed [80]
 ✓ basics: helm-install /tmp/dra-driver-nvidia-gpu/0.6.0-dev [6544]
 ✓ basics: helm list: validate output [104]
 ✓ basics: get crd computedomains.resource.nvidia.com [69]
 ✓ basics: wait for plugin & controller pods READY [506]
 ✓ basics: validate CD controller container image spec [72]
 ✓ basics: SIGUSR2 handler: GPU plugin, CD plugin [422]
test_cd_imex_chan_inject.bats
 ✓ CDs: IMEX channel injection (single) [6976]
 - CDs: IMEX channel injection (all) (skipped: tested chart version smaller than 25.8.0) [413]
test_cd_mnnvl_workload.bats
 ✓ CDs: nickelpie (NCCL send/recv/broadcast, 2 pods, 2 nodes, small payload) [11075]
 ✓ CDs: nvbandwidth (2 nodes, 2 GPUs each) [12593]
test_cd_misc.bats
 ✓ CDs: daemon shutdown: confirm CD status cleanup [13568]
 ✓ CDs: reject unknown field in opaque cfg in CD chan ResourceClaim [9900]
 ✓ CDs: self-initiated unprepare of stale RCs in PrepareStarted [24479]
 ✓ CDs: global CD status [15387]
 ✓ CDs: IMEX channel injection (featureGates.ComputeDomainClique=true) [13859]
test_cd_logging.bats
 ✓ CDs: controller/plugin: startup config / detail in logs on level 0 [7183]
 ✓ CDs: controller: test log verbosity levels [58682]
 ✓ CDs: daemon: test log verbosity levels [29688]
test_cd_failover.bats
 ✓ CDs: failover nvb: force-delete worker pod 0 [47851]
 ✓ CDs: failover nvb: force-delete all IMEX daemons [41618]
 ✓ CDs: failover nvb: regular-delete worker pod 1 [54493]
 ✓ CDs: nvb many-iteration wrapper [13314]
test_cd_updowngrade.bats
 ✓ CDs: downgrade: current-dev -> last-stable [19224]
 ✓ CDs: upgrade: wipe-state, install-last-stable, upgrade-to-current-dev [30461]
test_cd_leader_election.bats
 ✓ CD controller: leader election: exactly one leader among two replicas [4551]
 ✓ CD controller: leader election: standby acquires lease after leader is force-deleted [1635]

29 tests, 0 failures, 1 skipped in 455 seconds

With both ConsumableShares and ComputeDomainChannelReservations enabled:

--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1792542858
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort tests/bats/test_basics.bats tests/bats/test_cd_imex_chan_inject.bats tests/bats/test_cd_mnnvl_workload.bats tests/bats/test_cd_misc.bats tests/bats/test_cd_logging.bats tests/bats/test_cd_failover.bats tests/bats/test_cd_updowngrade.bats tests/bats/test_cd_leader_election.bats
test_basics.bats
 ✓ basics: test VERSION_W_COMMIT, VERSION_STAGING_CHART, VERSION [84]
 ✓ basics: confirm no kubelet plugin pods running [73]
 ✓ basics: GPU Operator installed [78]
 ✓ basics: helm-install /tmp/dra-driver-nvidia-gpu/0.6.0-dev [5780]
 ✓ basics: helm list: validate output [102]
 ✓ basics: get crd computedomains.resource.nvidia.com [68]
 ✓ basics: wait for plugin & controller pods READY [509]
 ✓ basics: validate CD controller container image spec [69]
 ✓ basics: SIGUSR2 handler: GPU plugin, CD plugin [429]
test_cd_imex_chan_inject.bats
 ✓ CDs: IMEX channel injection (single) [12636]
 - CDs: IMEX channel injection (all) (skipped: tested chart version smaller than 25.8.0) [346]
test_cd_mnnvl_workload.bats
 ✓ CDs: nickelpie (NCCL send/recv/broadcast, 2 pods, 2 nodes, small payload) [10637]
 ✓ CDs: nvbandwidth (2 nodes, 2 GPUs each) [16495]
test_cd_misc.bats
 ✓ CDs: daemon shutdown: confirm CD status cleanup [18522]
 ✓ CDs: reject unknown field in opaque cfg in CD chan ResourceClaim [7015]
 - CDs: self-initiated unprepare of stale RCs in PrepareStarted (skipped: invalid claims are rejected before Prepare with ComputeDomainChannelReservations) [2768]
 ✓ CDs: global CD status [20252]
 ✓ CDs: IMEX channel injection (featureGates.ComputeDomainClique=true) [18873]
test_cd_logging.bats
 ✓ CDs: controller/plugin: startup config / detail in logs on level 0 [6896]
 ✓ CDs: controller: test log verbosity levels [60413]
 ✓ CDs: daemon: test log verbosity levels [39302]
test_cd_failover.bats
 ✓ CDs: failover nvb: force-delete worker pod 0 [130639]
 ✓ CDs: failover nvb: force-delete all IMEX daemons [41899]
 ✓ CDs: failover nvb: regular-delete worker pod 1 [54332]
 ✓ CDs: nvb many-iteration wrapper [15665]
test_cd_updowngrade.bats
 ✓ CDs: downgrade: current-dev -> last-stable [23851]
 ✓ CDs: upgrade: wipe-state, install-last-stable, upgrade-to-current-dev [86562]
test_cd_leader_election.bats
 ✓ CD controller: leader election: exactly one leader among two replicas [4584]
 ✓ CD controller: leader election: standby acquires lease after leader is force-deleted [1642]

29 tests, 0 failures, 2 skipped in 611 seconds

@shivamerla
shivamerla force-pushed the cd_consumable_shares branch 3 times, most recently from d65792c to 5d59dcf Compare October 22, 2026 11:17
@shivamerla
shivamerla marked this pull request as ready for review October 22, 2026 16:13
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from dims and varunrsekar October 22, 2026 16:13
@shivamerla
shivamerla force-pushed the cd_consumable_shares branch from 5d59dcf to 7ba9a8e Compare October 26, 2026 14:18
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

The change adds gated IMEX channel reservations for ComputeDomains. The controller assigns channels, creates channel-pinned ResourceClaimTemplates, and admits claims before binding. DeviceTaintRules enforce driver-managed node ownership. The kubelet publishes configured channel devices, checks reservations during preparation, and injects allocated channels. Optional consumable shares allow claims from the same ComputeDomain to share a channel. The change also adds IMEX scope configuration, Helm settings, tests, and documentation.

Possibly related issues

  • Issue 1556 — The change assigns cluster-wide unique channels in host-managed mode and reuses those reservations for claims in the same ComputeDomain, matching the issue’s request for unique host-managed channels.
Merge Risk: Moderate · previous review 7ba9a

On clusters that do not serve resource.k8s.io/v1, upgrading could stall ComputeDomain reconciliation even with the new gate off, so the supported Kubernetes floor should be settled or the informer should be conditional before merging. The imex.isolation setting also does not behave as documented.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: shareable channels within a ComputeDomain (Consumable Shares) and multiple ComputeDomains per node (IMEX channel reservations). Both are central to the changeset,…
Linked Issues check Passed Issue [#1574] requires gated channel reservations, multiple pinned workload templates, host-managed unique channels, driver-managed node ownership, pre-binding admission with binding conditions and de…
Out of Scope Changes check Passed The changes remain connected to [#1574]. Configuration for IMEX scope and channel isolation, Helm values and RBAC, documentation, upgrade behavior, scale handling, and tests support channel reservatio…
Description check Passed The description states that the PR adds IMEX channel reservations per ComputeDomain behind the alpha ComputeDomainChannelReservations feature gate. The changeset matches this: it adds the feature gate…
Full details: Title check

Explanation

The title names the two main changes: shareable channels within a ComputeDomain (Consumable Shares) and multiple ComputeDomains per node (IMEX channel reservations). Both are central to the changeset, which adds channel reservations, pinned workload templates, admission, and consumable-share support. The title is concise and specific. It is 100 characters and 12 words, which is long but still readable.

Full details: Linked Issues check

Explanation

Issue [#1574] requires gated channel reservations, multiple pinned workload templates, host-managed unique channels, driver-managed node ownership, pre-binding admission with binding conditions and device taints, kubelet publication and validation, and Consumable Shares composition. The reviewed changes implement these areas in the API, controller, kubelet plugin, Helm chart, and documentation. Added unit, scale, benchmark, and BATS coverage tests reservations, admission, ownership, publication, sharing, compatibility, and cleanup. The summary also records the Kubernetes 1.36+ API handling and feature-gate behavior required by [#1574].

Full details: Out of Scope Changes check

Explanation

The changes remain connected to [#1574]. Configuration for IMEX scope and channel isolation, Helm values and RBAC, documentation, upgrade behavior, scale handling, and tests support channel reservation, admission, or compatibility objectives. The implementation does not claim to deliver the static IMEX daemon identified as future work for [#1574] and related issue [#920]. No unrelated change is demonstrated by the available whole-PR summary.

Full details: Description check

Explanation

The description states that the PR adds IMEX channel reservations per ComputeDomain behind the alpha ComputeDomainChannelReservations feature gate. The changeset matches this: it adds the feature gate, the count field and channels status on ComputeDomain, the ChannelReservationManager, the claim admission manager, kubelet plugin channel handling, Helm values, and docs. It also lists the affected docs, the Kubernetes 1.36+ requirement, and the test results. The description is specific and related to the changes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 1
pkg/imex/imex.go: 1

140-143: Minor · Functional Correctness · Quick win

imex.isolation has no effect on channel behavior.

In non-test Go files, Isolation is read only in Validate and String. Channel reservation, pinned template creation, and admission do not read it. They follow the ComputeDomainChannelReservations gate and the effective scope. An operator who sets imex.isolation=domain to keep channel 0 shared gets a separate channel for each host-managed ComputeDomain once the gate is enabled. Setting imex.isolation=channel only adds a gate check.

Choose one direction:

  • Document imex.isolation as reserved. Update its help text in values.yaml, helm-values.md, and compute-domains.md so the gate alone selects per-template channels. Reject channel until it has its own behavior.
  • Do not gate reservations on Isolation == IsolationIMEXChannel. The default value is domain, so that gate would disable reservations by default. This conflicts with the gate-driven design.
🧹 Nitpick comments: 1
cmd/compute-domain-controller/devicetaintrules.go: 1

91-95: Trivial · Performance & Scalability · Low value

nit: ensureDeviceTaintRule always starts with a Create. EnsureChannelTaintRules runs on every host-managed reconcile, including the 10-minute resyncs. Each reconcile therefore sends one failing Create and one Get per reserved channel. With many ComputeDomains, these calls use up the controller's QPS budget, which it also needs for claim admission writes. The node path (ensureNodeRule) already checks a cache first. You can do the same here: use a Get first or keep a rule informer for channel rules.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 43ce288 and 7ba9a8e.

Files ignored due to path filters: 2
  • api/nvidia.com/resource/v1beta1/zz_generated.deepcopy.go is excluded by !**/zz_generated.*.go
  • deployments/helm/dra-driver-nvidia-gpu/crds/resource.nvidia.com_computedomains.yaml is excluded by !deployments/helm/dra-driver-nvidia-gpu/crds/**
Files selected for processing: 41
  • api/nvidia.com/resource/v1beta1/computedomain.go
  • cmd/compute-domain-controller/channels.go
  • cmd/compute-domain-controller/channels_test.go
  • cmd/compute-domain-controller/claimadmission.go
  • cmd/compute-domain-controller/claimadmission_scale_test.go
  • cmd/compute-domain-controller/claimadmission_test.go
  • cmd/compute-domain-controller/computedomain.go
  • cmd/compute-domain-controller/controller.go
  • cmd/compute-domain-controller/devicetaintrules.go
  • cmd/compute-domain-controller/devicetaintrules_test.go
  • cmd/compute-domain-controller/main.go
  • cmd/compute-domain-controller/resourceclaimtemplate.go
  • cmd/compute-domain-kubelet-plugin/channel_reservations.go
  • cmd/compute-domain-kubelet-plugin/channel_reservations_test.go
  • cmd/compute-domain-kubelet-plugin/consumable_shares.go
  • cmd/compute-domain-kubelet-plugin/consumable_shares_test.go
  • cmd/compute-domain-kubelet-plugin/device_state.go
  • cmd/compute-domain-kubelet-plugin/device_state_test.go
  • cmd/compute-domain-kubelet-plugin/driver.go
  • cmd/compute-domain-kubelet-plugin/driver_test.go
  • cmd/compute-domain-kubelet-plugin/main.go
  • deployments/helm/dra-driver-nvidia-gpu/templates/_helpers.tpl
  • deployments/helm/dra-driver-nvidia-gpu/templates/controller.yaml
  • deployments/helm/dra-driver-nvidia-gpu/templates/deviceclass-compute-domain-channel.yaml
  • deployments/helm/dra-driver-nvidia-gpu/templates/kubeletplugin.yaml
  • deployments/helm/dra-driver-nvidia-gpu/templates/rbac-controller.yaml
  • deployments/helm/dra-driver-nvidia-gpu/values.yaml
  • pkg/featuregates/featuregates.go
  • pkg/imex/channels.go
  • pkg/imex/channels_test.go
  • pkg/imex/imex.go
  • pkg/imex/imex_test.go
  • site/content/contribute/proposals/0001-computedomain-channel-reservations.md
  • site/content/docs/concepts/compute-domains.md
  • site/content/docs/guides/compute-domain-workloads.md
  • site/content/docs/reference/feature-gates.md
  • site/content/docs/reference/helm-values.md
  • templates/compute-domain-daemon-claim-template.tmpl.yaml
  • templates/compute-domain-workload-claim-template.tmpl.yaml
  • tests/bats/helpers.sh
  • tests/bats/test_cd_misc.bats

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@klueska

klueska commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

I'm confused by this:

Several claim templates per ComputeDomain. spec.channel.resourceClaimTemplate.count generates N templates, each pinned to its own reserved channel (recorded in status.channels). Workloads using different templates share the ComputeDomain's IMEX daemon and nodes but are isolated from each other. A workload using the same template gets the same channel on every node.

The ComputeDomain abstraction was explicitly designed to have a 1:1 mapping with a single multi-node workload (i.e. the workload itself shouldn't have to know or care about channels). Unless I'm misunderstanding something, it sounds like this change will allow you to run multiple multi-node workloads as part of the same ComputeDomain but on different channels (thus breaking the design of this abstraction).

What is the reason for this? Why not keep the 1:1 mapping of ComputeDomain to multi-node workload, where each ComputeDomain gets a unique channel, instead of supporting multiple.

@shivamerla

Copy link
Copy Markdown
Contributor Author

I'm confused by this:

Several claim templates per ComputeDomain. spec.channel.resourceClaimTemplate.count generates N templates, each pinned to its own reserved channel (recorded in status.channels). Workloads using different templates share the ComputeDomain's IMEX daemon and nodes but are isolated from each other. A workload using the same template gets the same channel on every node.

The ComputeDomain abstraction was explicitly designed to have a 1:1 mapping with a single multi-node workload (i.e. the workload itself shouldn't have to know or care about channels). Unless I'm misunderstanding something, it sounds like this change will allow you to run multiple multi-node workloads as part of the same ComputeDomain but on different channels (thus breaking the design of this abstraction).

What is the reason for this? Why not keep the 1:1 mapping of ComputeDomain to multi-node workload, where each ComputeDomain gets a unique channel, instead of supporting multiple.

@klueska This enables multiple workloads to share a node while preserving domain isolation through a driver-managed daemon per ComputeDomain. A single claim template per CD, for e.g., using channel 0 limits it to one workload, such as a Dynamo Graph, leaving unused GPUs unavailable to other CD workloads. Multiple claim templates, each with a distinct channel, allow workloads to binpack on the same node while keeping channel reservations unique and non-overlapping across CDs.

The ComputeDomain boundary now groups related workloads for a user or namespace, rather than requiring them to share the entire NVLink partition as in static or host-managed daemon modes.

@klueska

klueska commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Im not saying you shouldn't allow workers from different multi-node workloads to run on the same node, I'm saying that each should be associated with a compute domain, not a different channel of the same compute domain.

The ComputeDomain should continue to be the boundary for a single multi-node workload, with added support to have workers from multiple ComputeDomains running on a node at once (each with a unique channel allocated to it).

This is the design JP and I had been working towards and wrote up in one of the issues (I'll need to dig it up).
Is there a particular reason not to do things this way?

I'm worried if you don't keep this 1:1 mapping of workload:ComputeDomain other subtle things will come to bite you down the road. For example, the support John Belamaric wanted where we flip the script to have a ResourceClaim create a ComouteDomain rather than the other way around.

@shivamerla

shivamerla commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

The ComputeDomain should continue to be the boundary for a single multi-node workload, with added support to have workers from multiple ComputeDomains running on a node at once (each with a unique channel allocated to it).

Running multiple CD workloads per node was only possible with hostmanaged or static IMEX daemons. I have added this approach, so users can still take advantage of dynamic per CD daemons, while running multiple workload pod replicas on the same node (for maximum usage of GPUs on the node). Do you think we don't have to support that option?

@shivamerla
shivamerla force-pushed the cd_consumable_shares branch 2 times, most recently from 4428a66 to fcca88f Compare October 30, 2026 00:00
@shivamerla

shivamerla commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

New tests with the updated design:

Use case1: Static IMEX daemonset and multiple CD workloads on the same node:

Resource slice with legacy and new device with type=imex-channel :

$ kubectl  get resourceslice 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-5ckt9 -o yaml
apiVersion: resource.k8s.io/v1
kind: ResourceSlice
metadata:
  creationTimestamp: "2026-10-29T23:15:40Z"
  generateName: 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-
  generation: 7
  name: 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-5ckt9
  ownerReferences:
  - apiVersion: v1
    controller: true
    kind: Node
    name: gb-nvl-156-compute13
    uid: b77e2397-86c7-42fd-9198-ce88352ff37d
  resourceVersion: "56100457"
  uid: 65bb5d5d-29ad-427d-97ff-92e0333b5b9c
spec:
  devices:
  - allowMultipleAllocations: true
    attributes:
      cliqueID:
        string: 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
      type:
        string: imex-channel
    bindingConditions:
    - compute-domain.nvidia.com/ChannelAdmitted
    bindingFailureConditions:
    - compute-domain.nvidia.com/ChannelRejected
    name: channel
  - attributes:
      id:
        int: 0
      type:
        string: channel
    name: channel-0
  - attributes:
      id:
        int: 0
      type:
        string: daemon
    name: daemon-0
  driver: compute-domain.nvidia.com
  nodeName: gb-nvl-156-compute13
  pool:
    generation: 1
    name: gb-nvl-156-compute13
    resourceSliceCount: 1

Resource claims created and status.devices.data fields updated with channel and domain ids:

$ kubectl get resourceclaim nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-chxvjf5 -o yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  annotations:
    resource.kubernetes.io/pod-claim-name: compute-domain-channel
  creationTimestamp: "2026-10-29T23:55:29Z"
  finalizers:
  - resource.kubernetes.io/delete-protection
  generateName: nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-ch
  name: nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-chxvjf5
  namespace: default
  ownerReferences:
  - apiVersion: v1
    controller: true
    kind: Pod
    name: nvlink-test-1-decode-15897f39-6bb7d8b5bd-hktgg
    uid: 5344a369-2ddd-4385-a9b9-52f87ac596f3
  resourceVersion: "56102207"
  uid: 2d3eccfc-147a-49fe-9f50-b4332b5f0cb5
spec:
  devices:
    config:
    - opaque:
        driver: compute-domain.nvidia.com
        parameters:
          allocationMode: Single
          apiVersion: resource.nvidia.com/v1beta1
          domainID: f5cf53de-f15d-40d5-8fbe-41b56ccceeca
          kind: ComputeDomainChannelConfig
          resourceClaimTemplateName: imex-channel-cd-1
      requests:
      - channel
    requests:
    - exactly:
        allocationMode: ExactCount
        count: 1
        deviceClassName: compute-domain-channel.nvidia.com
      name: channel
status:
  allocation:
    allocationTimestamp: "2026-10-29T23:55:29Z"
    devices:
      config:
      - opaque:
          driver: compute-domain.nvidia.com
          parameters:
            allocationMode: Single
            apiVersion: resource.nvidia.com/v1beta1
            domainID: f5cf53de-f15d-40d5-8fbe-41b56ccceeca
            kind: ComputeDomainChannelConfig
            resourceClaimTemplateName: imex-channel-cd-1
        requests:
        - channel
        source: FromClaim
      results:
      - bindingConditions:
        - compute-domain.nvidia.com/ChannelAdmitted
        bindingFailureConditions:
        - compute-domain.nvidia.com/ChannelRejected
        device: channel
        driver: compute-domain.nvidia.com
        pool: gb-nvl-156-compute14
        request: channel
        shareID: 33376e1a-c780-41a0-b0fd-36e56288a342
    nodeSelector:
      nodeSelectorTerms:
      - matchFields:
        - key: metadata.name
          operator: In
          values:
          - gb-nvl-156-compute14
  devices:
  - conditions:
    - lastTransitionTime: "2026-10-29T23:55:29Z"
      message: channel 4 admitted for the ComputeDomain in 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
      reason: Admitted
      status: "True"
      type: compute-domain.nvidia.com/ChannelAdmitted
    data:
      channel: 4
      imexDomain: 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
    device: channel
    driver: compute-domain.nvidia.com
    pool: gb-nvl-156-compute14
    shareID: 33376e1a-c780-41a0-b0fd-36e56288a342
  reservedFor:
  - name: nvlink-test-1-decode-15897f39-6bb7d8b5bd-hktgg
    resource: pods
    uid: 5344a369-2ddd-4385-a9b9-52f87ac596f3

All 4 workloads from 4 different CDs running on mix of nodes:

$ kubectl  get computedomain
NAME                  AGE
my-compute-domain-1   13m
my-compute-domain-2   13m
my-compute-domain-3   13m
my-compute-domain-4   13m
$ kubectl  get pods -o wide
NAME                                              READY   STATUS    RESTARTS   AGE                 NODE                   NOMINATED NODE   READINESS GATES
nvlink-test-1-decode-15897f39-6bb7d8b5bd-hktgg    1/1     Running   0          12m      gb-nvl-156-compute14   <none>           <none>
nvlink-test-1-frontend-864d4bb445-lbvsw           1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-1-prefill-15897f39-d454b8b7d-g4wwh    1/1     Running   0          12m       gb-nvl-156-compute13   <none>           <none>
nvlink-test-2-decode-89ecb10b-748c57bb4d-qfsw2    1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-2-frontend-84b59bf87f-fn6lw           1/1     Running   0          12m       gb-nvl-156-compute14   <none>           <none>
nvlink-test-2-prefill-89ecb10b-77894c8844-cpkbq   1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-3-decode-d7a275a5-879c49f6-4vrg9      1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-3-frontend-676bfb95c7-blr2g           1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-3-prefill-d7a275a5-5b46f76cb6-dl6b5   1/1     Running   0          12m     gb-nvl-156-compute16   <none>           <none>
nvlink-test-4-decode-8549d047-65bcf6696c-rx8v9    1/1     Running   0          12m      gb-nvl-156-compute13   <none>           <none>
nvlink-test-4-frontend-564f87df87-mfjnm           1/1     Running   0          12m      gb-nvl-156-compute16   <none>           <none>
nvlink-test-4-prefill-8549d047-76ddb4957c-s57s7   1/1     Running   0          12m       gb-nvl-156-compute14   <none>           <none>

@shivamerla

shivamerla commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Use Case 2: Dynamic IMEX daemons (per computedomain)

DeviceClass requesting the imex-channel device:

$ kubectl  get deviceclass compute-domain-channel.nvidia.com -o yaml
apiVersion: resource.k8s.io/v1
kind: DeviceClass
metadata:
  annotations:
    meta.helm.sh/release-name: dra-driver-nvidia-gpu
    meta.helm.sh/release-namespace: dra-driver-nvidia-gpu
  creationTimestamp: "2026-10-29T19:41:29Z"
  generation: 2
  labels:
    app.kubernetes.io/managed-by: Helm
  name: compute-domain-channel.nvidia.com
  resourceVersion: "56086182"
  uid: 69b8a203-8de8-4f53-bd76-aabf31118ca9
spec:
  selectors:
  - cel:
      expression: device.driver == 'compute-domain.nvidia.com' && device.attributes['compute-domain.nvidia.com'].type
        == 'imex-channel'

Resource slice with imex-channel device and device taint:

$ kubectl  get resourceslice 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-5ckt9 -o yaml
apiVersion: resource.k8s.io/v1
kind: ResourceSlice
metadata:
  creationTimestamp: "2026-10-29T23:15:40Z"
  generateName: 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-
  generation: 8
  name: 00000-compute-domain.nvidia.com-gb-nvl-156-compute13-5ckt9
  ownerReferences:
  - apiVersion: v1
    controller: true
    kind: Node
    name: gb-nvl-156-compute13
    uid: b77e2397-86c7-42fd-9198-ce88352ff37d
  resourceVersion: "56111982"
  uid: 65bb5d5d-29ad-427d-97ff-92e0333b5b9c
spec:
  devices:
  - allowMultipleAllocations: true
    attributes:
      cliqueID:
        string: 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
      type:
        string: imex-channel
    bindingConditions:
    - compute-domain.nvidia.com/ChannelAdmitted
    bindingFailureConditions:
    - compute-domain.nvidia.com/ChannelRejected
    name: channel
    taints:
    - effect: NoSchedule
      key: compute-domain.nvidia.com/computeDomain
      timeAdded: "2026-10-30T00:34:51Z"
      value: 5822f201-6f9e-422d-8511-2294ee2a4c3a
  - attributes:
      id:
        int: 0
      type:
        string: channel
    name: channel-0
  - attributes:
      id:
        int: 0
      type:
        string: daemon
    name: daemon-0
  driver: compute-domain.nvidia.com
  nodeName: gb-nvl-156-compute13
  pool:
    generation: 1
    name: gb-nvl-156-compute13
    resourceSliceCount: 1

ComputeDomains and ResourceClaimTemplates with tolerations added:

$ kubectl  get computedomain
NAME                  AGE
my-compute-domain-1   100s
my-compute-domain-2   100s
my-compute-domain-3   100s
my-compute-domain-4   100s

$ kubectl  get resourceclaimtemplates imex-channel-cd-1 -o yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaimTemplate
metadata:
  creationTimestamp: "2026-10-30T00:34:50Z"
  finalizers:
  - resource.nvidia.com/computeDomain
  labels:
    resource.nvidia.com/computeDomain: 5822f201-6f9e-422d-8511-2294ee2a4c3a
    resource.nvidia.com/computeDomainTarget: Workload
  name: imex-channel-cd-1
  namespace: default
  resourceVersion: "56111300"
  uid: 4871802b-73c3-4e9b-aa18-a0220937f4bc
spec:
  metadata: {}
  spec:
    devices:
      config:
      - opaque:
          driver: compute-domain.nvidia.com
          parameters:
            allocationMode: Single
            apiVersion: resource.nvidia.com/v1beta1
            domainID: 5822f201-6f9e-422d-8511-2294ee2a4c3a
            kind: ComputeDomainChannelConfig
            resourceClaimTemplateName: imex-channel-cd-1
        requests:
        - channel
      requests:
      - exactly:
          allocationMode: ExactCount
          count: 1
          deviceClassName: compute-domain-channel.nvidia.com
          tolerations:
          - effect: NoSchedule
            key: compute-domain.nvidia.com/computeDomain
            operator: Equal
            value: 5822f201-6f9e-422d-8511-2294ee2a4c3a
        name: channel

ResourceClaim with channel added in the status.devices.data field along with tolerations:

$ kubectl  get resourceclaims nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-chc5ldj  -o yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  annotations:
    resource.kubernetes.io/pod-claim-name: compute-domain-channel
  creationTimestamp: "2026-10-30T00:34:51Z"
  finalizers:
  - resource.kubernetes.io/delete-protection
  generateName: nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-ch
  name: nvlink-test-1-decode-15897f39-6bb7d8b-compute-domain-chc5ldj
  namespace: default
  ownerReferences:
  - apiVersion: v1
    controller: true
    kind: Pod
    name: nvlink-test-1-decode-15897f39-6bb7d8b5bd-qgt4m
    uid: 440b32d1-4363-427d-8bb7-1fc924e721d7
  resourceVersion: "56112020"
  uid: 4ce271d1-ce5c-4cd6-9e20-f3ff82e24949
spec:
  devices:
    config:
    - opaque:
        driver: compute-domain.nvidia.com
        parameters:
          allocationMode: Single
          apiVersion: resource.nvidia.com/v1beta1
          domainID: 5822f201-6f9e-422d-8511-2294ee2a4c3a
          kind: ComputeDomainChannelConfig
          resourceClaimTemplateName: imex-channel-cd-1
      requests:
      - channel
    requests:
    - exactly:
        allocationMode: ExactCount
        count: 1
        deviceClassName: compute-domain-channel.nvidia.com
        tolerations:
        - effect: NoSchedule
          key: compute-domain.nvidia.com/computeDomain
          operator: Equal
          value: 5822f201-6f9e-422d-8511-2294ee2a4c3a
      name: channel
status:
  allocation:
    allocationTimestamp: "2026-10-30T00:34:51Z"
    devices:
      config:
      - opaque:
          driver: compute-domain.nvidia.com
          parameters:
            allocationMode: Single
            apiVersion: resource.nvidia.com/v1beta1
            domainID: 5822f201-6f9e-422d-8511-2294ee2a4c3a
            kind: ComputeDomainChannelConfig
            resourceClaimTemplateName: imex-channel-cd-1
        requests:
        - channel
        source: FromClaim
      results:
      - bindingConditions:
        - compute-domain.nvidia.com/ChannelAdmitted
        bindingFailureConditions:
        - compute-domain.nvidia.com/ChannelRejected
        device: channel
        driver: compute-domain.nvidia.com
        pool: gb-nvl-156-compute13
        request: channel
        shareID: 0abc6ee8-4376-43d4-a348-a3280d691cae
        tolerations:
        - effect: NoSchedule
          key: compute-domain.nvidia.com/computeDomain
          operator: Equal
          value: 5822f201-6f9e-422d-8511-2294ee2a4c3a
    nodeSelector:
      nodeSelectorTerms:
      - matchFields:
        - key: metadata.name
          operator: In
          values:
          - gb-nvl-156-compute13
  devices:
  - conditions:
    - lastTransitionTime: "2026-10-30T00:34:51Z"
      message: channel 4 admitted for the ComputeDomain in 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
      reason: Admitted
      status: "True"
      type: compute-domain.nvidia.com/ChannelAdmitted
    data:
      channel: 4
      imexDomain: 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
    device: channel
    driver: compute-domain.nvidia.com
    pool: gb-nvl-156-compute13
    shareID: 0abc6ee8-4376-43d4-a348-a3280d691cae
  reservedFor:
  - name: nvlink-test-1-decode-15897f39-6bb7d8b5bd-qgt4m
    resource: pods
    uid: 440b32d1-4363-427d-8bb7-1fc924e721d7

Multiple workloads with no overlapping prefill/decode on the same node:

$ kubectl  get pods -o wide
NAME                                              READY   STATUS    RESTARTS   AGE                   NODE                   NOMINATED NODE   READINESS GATES
nvlink-test-1-decode-15897f39-6bb7d8b5bd-qgt4m    1/1     Running   0          4m56s      gb-nvl-156-compute13   <none>           <none>
nvlink-test-1-frontend-864d4bb445-xfhr8           1/1     Running   0          4m56s       gb-nvl-156-compute15   <none>           <none>
nvlink-test-1-prefill-15897f39-d454b8b7d-tdrz4    1/1     Running   0          4m56s      gb-nvl-156-compute13   <none>           <none>

nvlink-test-2-decode-89ecb10b-748c57bb4d-6qtdv    1/1     Running   0          4m57s      gb-nvl-156-compute16   <none>           <none>
nvlink-test-2-frontend-84b59bf87f-zd8zg           1/1     Running   0          4m57s        gb-nvl-156-compute15   <none>           <none>
nvlink-test-2-prefill-89ecb10b-77894c8844-wqdd9   1/1     Running   0          4m57s      gb-nvl-156-compute16   <none>           <none>

nvlink-test-3-decode-d7a275a5-879c49f6-jvq56      1/1     Running   0          4m56s    gb-nvl-156-compute14   <none>           <none>
nvlink-test-3-frontend-676bfb95c7-hxcrp           1/1     Running   0          4m57s    gb-nvl-156-compute13   <none>           <none>
nvlink-test-3-prefill-d7a275a5-5b46f76cb6-59wkv   1/1     Running   0          4m57s     gb-nvl-156-compute14   <none>           <none>

nvlink-test-4-decode-8549d047-65bcf6696c-2dqsx    1/1     Running   0          4m56s    gb-nvl-156-compute15   <none>           <none>
nvlink-test-4-frontend-564f87df87-2k4nm           1/1     Running   0          4m56s      gb-nvl-156-compute15   <none>           <none>
nvlink-test-4-prefill-8549d047-76ddb4957c-pg8ss   1/1     Running   0          4m56s     gb-nvl-156-compute15   <none>           <none>

@shivamerla

Copy link
Copy Markdown
Contributor Author

CD with multiple templates:

$ kubectl  get computedomain
NAME                  AGE
my-compute-domain-1   4m58s
my-compute-domain-2   4m58s
my-compute-domain-3   4m58s
my-compute-domain-4   4m58s

nvidia@gb-nvl-156-compute13:/home/nvidia/shiva/demo-static-imex/per-cd-dynamic$ kubectl  get computedomain my-compute-domain-1 -o yaml
apiVersion: resource.nvidia.com/v1beta1
kind: ComputeDomain
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"resource.nvidia.com/v1beta1","kind":"ComputeDomain","metadata":{"annotations":{},"name":"my-compute-domain-1","namespace":"default"},"spec":{"channels":[{"resourceClaimTemplate":{"name":"imex-channel-cd-1-1"}},{"resourceClaimTemplate":{"name":"imex-channel-cd-1-2"}}]}}
  creationTimestamp: "2026-10-30T01:08:16Z"
  finalizers:
  - resource.nvidia.com/computeDomain
  generation: 1
  name: my-compute-domain-1
  namespace: default
  resourceVersion: "56120698"
  uid: aff45636-8758-4a56-8860-76e948c779ba
spec:
  channels:
  - resourceClaimTemplate:
      name: imex-channel-cd-1-1
  - resourceClaimTemplate:
      name: imex-channel-cd-1-2
  numNodes: 0
status:
  status: Ready

All replicas of 4 workloads running on respective nodes (node-selector pinned):

$ kubectl  get pods -o wide
NAME                                             READY  STATUS   NODE
nvlink-test-1-decode-1b03b49e-9849846b5-44d79    1/1    Running  gb-nvl-156-compute13
nvlink-test-1-decode-1b03b49e-9849846b5-n4njk    1/1    Running  gb-nvl-156-compute13
nvlink-test-1-frontend-864d4bb445-gbrfq          1/1    Running  gb-nvl-156-compute15
nvlink-test-1-prefill-1b03b49e-5979948974-42zvn  1/1    Running  gb-nvl-156-compute13
nvlink-test-1-prefill-1b03b49e-5979948974-csb7n  1/1    Running  gb-nvl-156-compute13

nvlink-test-2-decode-9e9dfd84-95d8f7469-9qts7    1/1    Running  gb-nvl-156-compute14
nvlink-test-2-decode-9e9dfd84-95d8f7469-s8w8m    1/1    Running  gb-nvl-156-compute14
nvlink-test-2-frontend-84b59bf87f-pc2zw          1/1    Running  gb-nvl-156-compute15
nvlink-test-2-prefill-9e9dfd84-5c4777f6db-89r77  1/1    Running  gb-nvl-156-compute14
nvlink-test-2-prefill-9e9dfd84-5c4777f6db-qf9gh  1/1    Running  gb-nvl-156-compute14

nvlink-test-3-decode-7d21b647-fc464549d-28zsp    1/1    Running  gb-nvl-156-compute15
nvlink-test-3-decode-7d21b647-fc464549d-ftddz    1/1    Running  gb-nvl-156-compute15
nvlink-test-3-frontend-676bfb95c7-6bvbq          1/1    Running  gb-nvl-156-compute14
nvlink-test-3-prefill-7d21b647-6d767b9c59-5bw5b  0/1    Running  gb-nvl-156-compute15
nvlink-test-3-prefill-7d21b647-6d767b9c59-qdztp  1/1    Running  gb-nvl-156-compute15

nvlink-test-4-decode-77177cdb-6d4c8dd644-frwnb   1/1    Running  gb-nvl-156-compute16
nvlink-test-4-decode-77177cdb-6d4c8dd644-ntkrv   1/1    Running  gb-nvl-156-compute16
nvlink-test-4-frontend-564f87df87-nfbvj          1/1    Running  gb-nvl-156-compute14
nvlink-test-4-prefill-77177cdb-7b89fbbd8f-cmdpm  1/1    Running  gb-nvl-156-compute16
nvlink-test-4-prefill-77177cdb-7b89fbbd8f-xnzt4  1/1    Running  gb-nvl-156-compute16

@shivamerla

Copy link
Copy Markdown
Contributor Author

Bats suite:

--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793330443
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort --filter-tags '!cd-static,!cd-reservations' tests/bats/test_cd_modes.bats tests/bats/test_cd_churn.bats
test_cd_modes.bats
 ✓ CD modes (per-cd): channel injection [15285]
 ✓ CD modes (per-cd): workload across a clique [13518]
 ✓ CD modes (per-cd): node reuse without waiting for cleanup [34511]
 ✓ CD modes (per-cd): cleanup after force-deleted pods [28393]
 ✓ CD modes (per-cd): ComputeDomain deleted before its pods run [8265]
 ✓ CD modes (per-cd): kubelet plugin restart keeps workloads [26589]
 ✓ CD modes (per-cd): controller restarts during create and delete [13664]
 ✓ CD modes (per-cd): a node runs one ComputeDomain at a time [81233]
 ✓ CD modes (per-cd): a ComputeDomain sets channel or channels [637]
test_cd_churn.bats
 ✓ CD modes (per-cd): churn for 120s [234328]

10 tests, 0 failures in 468 seconds

BATS_RUN_TMPDIR: /tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793330443/bats-run-lwbi21


--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793330918
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort --filter-tags '!cd-static' tests/bats/test_cd_modes.bats tests/bats/test_cd_churn.bats
test_cd_modes.bats
 ✓ CD modes (per-cd-reservations): channel injection [16751]
 ✓ CD modes (per-cd-reservations): workload across a clique [14996]
 ✓ CD modes (per-cd-reservations): node reuse without waiting for cleanup [42233]
 ✓ CD modes (per-cd-reservations): cleanup after force-deleted pods [28352]
 ✓ CD modes (per-cd-reservations): ComputeDomain deleted before its pods run [8253]
 ✓ CD modes (per-cd-reservations): kubelet plugin restart keeps workloads [29693]
 ✓ CD modes (per-cd-reservations): controller restarts during create and delete [15093]
 ✓ CD modes (per-cd-reservations): one reserved channel per template [16796]
 ✓ CD modes (per-cd-reservations): a node runs one ComputeDomain at a time [90511]
 ✓ CD modes (per-cd-reservations): pods of a template share its channel on a node [14651]
 ✓ CD modes (per-cd-reservations): one shared channel device per node [575]
 ✓ CD modes (per-cd-reservations): the channel device names the owner or clique of its node [16351]
 ✓ CD modes (per-cd-reservations): a ComputeDomain sets channel or channels [639]
test_cd_churn.bats
 ✓ CD modes (per-cd-reservations): churn for 120s [254864]

14 tests, 0 failures in 559 seconds

BATS_RUN_TMPDIR: /tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793330918/bats-run-iBXssK

--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793331486
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort --filter-tags '!cd-static' tests/bats/test_cd_modes.bats tests/bats/test_cd_churn.bats
test_cd_modes.bats
 ✓ CD modes (per-cd-channel): channel injection [14624]
 ✓ CD modes (per-cd-channel): workload across a clique [14982]
 ✓ CD modes (per-cd-channel): node reuse without waiting for cleanup [44679]
 ✓ CD modes (per-cd-channel): cleanup after force-deleted pods [26049]
 ✓ CD modes (per-cd-channel): ComputeDomain deleted before its pods run [8237]
 ✓ CD modes (per-cd-channel): kubelet plugin restart keeps workloads [29789]
 ✓ CD modes (per-cd-channel): controller restarts during create and delete [15694]
 ✓ CD modes (per-cd-channel): one reserved channel per template [14687]
 ✓ CD modes (per-cd-channel): a node runs one ComputeDomain at a time [87989]
 ✓ CD modes (per-cd-channel): pods of a template share its channel on a node [16717]
 ✓ CD modes (per-cd-channel): one shared channel device per node [582]
 ✓ CD modes (per-cd-channel): the channel device names the owner or clique of its node [16470]
 ✓ CD modes (per-cd-channel): a ComputeDomain sets channel or channels [625]
test_cd_churn.bats
 ✓ CD modes (per-cd-channel): churn for 120s [292102]

14 tests, 0 failures in 593 seconds

BATS_RUN_TMPDIR: /tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793331486/bats-run-S6gjTt

--- STARTING TEST SUITE ---
+ TMPDIR=/tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793332087
+ bats --print-output-on-failure --no-tempdir-cleanup --timing --abort --filter-tags '!cd-per-cd' tests/bats/test_cd_modes.bats tests/bats/test_cd_churn.bats
test_cd_modes.bats
 ✓ CD modes (static): channel injection [9334]
 ✓ CD modes (static): workload across a clique [10269]
 ✓ CD modes (static): node reuse without waiting for cleanup [21929]
 ✓ CD modes (static): cleanup after force-deleted pods [17502]
 ✓ CD modes (static): ComputeDomain deleted before its pods run [8216]
 ✓ CD modes (static): kubelet plugin restart keeps workloads [22816]
 ✓ CD modes (static): controller restarts during create and delete [10602]
 ✓ CD modes (static): one reserved channel per template [11383]
 ✓ CD modes (static): static daemons serve ComputeDomains on one node [10117]
 ✓ CD modes (static): static daemons serve two ComputeDomains across a clique [10661]
 ✓ CD modes (static): pods of a template share its channel on a node [11514]
 ✓ CD modes (static): one shared channel device per node [584]
 ✓ CD modes (static): the channel device names the owner or clique of its node [11144]
 ✓ CD modes (static): a ComputeDomain sets channel or channels [621]
 ✓ CD modes (static): static daemon rollout keeps workloads [19470]
 ✓ CD modes (static): static daemons outlive deletion until workloads end [49004]
test_cd_churn.bats
 ✓ CD modes (static): churn for 120s [244962]

17 tests, 0 failures in 492 seconds

BATS_RUN_TMPDIR: /tmp/k8s-dra-driver-gpu-tests-out-nvidia/bats-tests-1793332087/bats-run-PiX6ZS

@klueska klueska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it partway through this review. but had to stop on commit 4 about halfway through.


// ComputeDomainChannelEntry provides the spec for one of several channels of
// a ComputeDomain.
type ComputeDomainChannelEntry struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a better name for this? I understand why we need something else and can't just use ComputeDomainChannelSpec (because these ones can't have AllocationMode), but the name feels off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. How about ComputeDomainReservedChannelSpec? It matches the channel reservations feature, and since each entry is backed by exactly one reserved channel, it makes clear why there’s no AllocationMode. It’s only the Go type name, so the JSON and the CRD schema stay the same.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for me.


// ComputeDomainResourceClaimTemplate provides the details of the ResourceClaimTemplate to generate.
type ComputeDomainResourceClaimTemplate struct {
// +kubebuilder:validation:MaxLength=253

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there actually more validation we should have here? What are the actual properties that such a name must have?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, the name has to be a DNS-1123 subdomain since it becomes the ResourceClaimTemplate name, so I’ll add a pattern to the CRD and the same check in the channel config validation.

Comment on lines +131 to +132
// GetChannels returns channel or channels as a list, so that callers handle
// both forms alike.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention the word normalize -- as in we normalize both fields into a common representation

Comment on lines +56 to +59
// ResourceClaimTemplateName names the workload ResourceClaimTemplate of
// the claim. With channel reservations, claims of one template share
// a channel in each NVLink clique.
ResourceClaimTemplateName string `json:"resourceClaimTemplateName,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wold have expected the actual channel number to be stored here. Why the template name? It feels non-intuitive to be forced to store the template name here.

Maybe we call the field something else, but in reality just use the resourceclaimtemplatename as the value?

So like channelIDLookupKey or something.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a seaprate max length variable than template name (even if the values are the same)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can’t hold the channel number as the config is rendered into the template before scheduling, and the channel differs per NVLink clique, assigned at admission. The field is really a grouping key, so I’m fine renaming it, maybe to channelGroup, with the template name as its value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChannelRef?

// ComputeDomainChannelReservations feature gate.
// +listType=atomic
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=128

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like alot, but I haven't done the math to see how big a spec grows because of it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size isn’t the concern: even with every entry at max length it’s ~37KB, far below the 1.5MiB limit. Entries don’t reserve channels either, since a channel is only reserved when a claim from that template is admitted. What they do cost is that the controller generates a ResourceClaimTemplate for every entry up front.

I kept the cap high because the CD spec is immutable, so the list has to name every template up front. But it makes sense to lower it to 32 and raise it later if needed, since raising maxItems is backward compatible.

Comment thread pkg/imex/channels.go
Comment on lines +66 to +68
// IMEXDomain is where the channel is unique: the NVLink clique of the
// node, or the node itself if it has none.
IMEXDomain string `json:"imexDomain"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What value does this take on? We haven't had a "named" IMEXDomain concept until now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The controller uses this to keep channels unique per clique at admission. It’s recorded in the claim status so the controller keeps the mapping right even if a node’s clique ID changes. On non-MNNVL nodes (HGX) there’s a proposal to still run IMEX there, to avoid hostIPC. Workload pods on the same node would then still need unique channels, so for those nodes it holds the node name instead. Below is the sample where the claim status.devices.data is updated with this info. May be channelScope would be a better name?

  devices:
  - conditions:
    - lastTransitionTime: "2026-10-29T23:55:29Z"
      message: channel 4 admitted for the ComputeDomain in 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
      reason: Admitted
      status: "True"
      type: compute-domain.nvidia.com/ChannelAdmitted
    data:
      channel: 4
      imexDomain: 9561f0f1-93a2-4d52-9e29-4041d4aa1d4c.32766
    device: channel
    driver: compute-domain.nvidia.com
    pool: gb-nvl-156-compute14
    shareID: 33376e1a-c780-41a0-b0fd-36e56288a342

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand where this is publishing to. I assume this is the code that somehow publishes a reserved IMEX channel somwhere so each kubelet plugin can discover it. Where is it publishing this though -- its non-obvious reading this file top to bottom.

@shivamerla shivamerla Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It publishes the node’s ResourceSlice, not reserved channels. It republishes the slice when the node’s ComputeDomain owner label changes, so the shared channel device keeps the right owner taint. The controller assigns the channels themselves at admission. Agree the name might be confusing, so I’ll rename it to resourceslice_publisher.go and add a comment about it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really shouldn't be in the business of republishing resource slices. It's an anti-pattern, and only something that should be done as a "hack" to get around some limitation in the current API.

If it is truly necessary, what is missing in the upstream API that would allow us to move away from this.

@shivamerla shivamerla Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. The only real reason is the owner taint. A node’s channel device should only be shared by claims of the one ComputeDomain whose IMEX daemon runs there. I can move that to a DeviceTaintRule the controller manages per node, so the plugin only publishes the slice when the clique changes, which is a real device change. But i wanted to avoid the controller having to create too many devicetaintrules (per node) in the scale cluster. The missing upstream piece is a way to say “this device allows multiple allocations, but only from claims that share a key” (like the ComputeDomain). With that, neither the taint nor the admission check for it would be needed. With static daemons this is not required, but is needed for per computedomain scope to steer other CD claims away as the scheduling time.

Comment on lines +125 to +132
// OnCliqueIDChange registers a function called with each changed GPU clique
// ID.
func (m *ComputeDomainManager) OnCliqueIDChange(f func(cliqueID string)) {
m.cliqueIDMu.Lock()
defer m.cliqueIDMu.Unlock()
m.onCliqueIDChange = f
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be aout of scope for this PR. At the moment we assume cliques can't change dyamically and a change like this deserves its own PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin already refreshes the clique ID on main (periodicGPUCliqueIDRefresh), so this doesn’t add dynamic clique support. It just keeps the published channel device’s clique in step with that refresh. Without it the slice would keep a stale clique, and admission would hand out channels unique to the wrong clique. Happy to split it out if you’d still prefer, but it’s a small hook on existing behavior.

@klueska klueska Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is a valid use of refresh -- something that very infrequently changes and reflects a change in the state of the system outside of our driver. Where we should never republish is to capture state / store info about state changes etc. for the driver itself (which is what it felt like owner was doing above).

Type string
ComputeDomain string
containerEdits *cdiapi.ContainerEdits
// channelID is the channel prepared for the shared channel device.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is thsi comment necessary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were we not checkpoitning the channel ID before?
If not, why do we suddenly need it now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was checkpointed before and still is, in the same field (PreparedDevice.Channel.Info.ID). Before, the ID came from the channel device itself. The shared device has no ID of its own, so the ID now comes from the claim’s admitted channel instead. channelID is unexported, so it’s in-memory only and just carries that ID from the config step to the prepared device. I’ll drop the comment.

Comment on lines +565 to +571
info := s.allocatable[result.Device].Channel
// Claims share the channel device, so record their own channel.
if info.Shared() {
info = &ComputeDomainChannelInfo{ID: preparedDeviceGroupConfigState[c].channelID}
}
preparedDevice.Channel = &PreparedComputeDomainChannel{
Info: s.allocatable[result.Device].Channel,
Info: info,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats going on here? Why wouldnt we always record it as before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, each channel device represented a fixed channel, so its allocatable info had the correct channel ID. With the shared channel device, multiple claims use the same device, and each claim gets its channel assigned at admission. We need to record that assigned channel, otherwise, every claim would be checkpointed with the shared device’s placeholder ID. Non-shared devices are recorded as before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm mostly confused by the pattern here then.

	info := s.allocatable[result.Device].Channel
	// Claims share the channel device, so record their own channel.
	if info.Shared() {
		info = &ComputeDomainChannelInfo{ID: preparedDeviceGroupConfigState[c].channelID}
	}

it feels weird to assign info to something -- look if its shared -- and then overwrite it if it is.

Without looking at the code, I assume you check Shared() by seeing if the ID is unassigned, and assume in all cases when its assigned, then its not shared?

Can we do something more explicit to make the logic here more readable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it’s a sentinel ID (-1) for the shared device, which is implicit. I’ll make the shared device an explicit kind on the allocatable device instead, and pick the ID with a clear branch, the claim’s admitted channel for the shared device, the device’s own ID otherwise.

@shivamerla
shivamerla force-pushed the cd_consumable_shares branch from fcca88f to f71b7eb Compare November 1, 2026 05:02
Let a ComputeDomain list several workload ResourceClaimTemplates in
spec.channels, and name the template in the ComputeDomainChannelConfig,
so that the controller can give each template its own IMEX channel.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
imex.scope says whose IMEX daemons run on a node: one set per
ComputeDomain (computeDomain, the default for driverManaged) or one set
shared by all ComputeDomains (cluster, implied by hostManaged).

The alpha ComputeDomainChannelReservations gate unlocks
imex.isolation=channel. Later commits use it to give each workload
ResourceClaimTemplate its own IMEX channel.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
Name the shared channel device, its imex-channel type and
cliqueID attribute, the taint that marks the ComputeDomain owning a
node, and the {channel, imexDomain} data the controller writes into a
claim's device status at admission. Bound the channels assigned per
clique with imex.maxChannels.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
With ComputeDomainChannelReservations, publish one channel device
that any number of channel claims on the node share, with no channel
ID or capacity, beside the channel-0 device that templates created
before the gate request. It names the NVLink clique of the node, and
with per-ComputeDomain IMEX daemons it carries a NoSchedule taint with
the ComputeDomain owning the node, from the node label the plugin
watches. The device is published once the plugin is ready and kept
across IMEX daemon restarts.

Prepare injects the channel the controller wrote into the claim's
device status at admission, and CDI specs name the allocated device,
so the kubelet resolves the shared device's CDI IDs. Claims of a
ComputeDomain share their channel on a node, and only the first one
sets up its IMEX daemon.

The device has its own type, imex-channel, so that the new
compute-domain-channel.nvidia.com DeviceClass selects it and
compute-domain-default-channel.nvidia.com stays unchanged.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
With ComputeDomainChannelReservations, render one workload
ResourceClaimTemplate per entry of spec.channels. Each requests the
shared channel device, tolerates only its own ComputeDomain's
owner taint with per-ComputeDomain IMEX daemons, and names itself in
its channel config, so that claims of one template can share a
channel.

Templates of ComputeDomains created before the gate are kept, so their
pods keep running on channel 0 as without it. Rename the host-managed
paths for a shared IMEX domain, as imex.scope=cluster takes them too.

Claims of the new templates wait for admission, added next.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
Claims of the shared channel device wait for the ChannelAdmitted
binding condition before their pod binds. The controller admits each
claim and writes its channel into the claim's device status. A channel
is unique in the IMEX domain of the node, its NVLink clique from the
channel device's cliqueID, and shared by claims of one template there.
Channel 0 stays with templates from before the gate, and a freed
channel is reused last. Assignments are rebuilt from admitted claims
after a restart.

With per-ComputeDomain IMEX daemons, a node runs one ComputeDomain. The
controller labels the node for the ComputeDomain of its first admitted
claim, which also starts its IMEX daemon and makes the plugin publish
the owner, and rejects claims of other ComputeDomains there with
ChannelRejected, so the scheduler tries another node. It releases the
label of nodes whose claims went away before being prepared. Decisions
are serialized per node.

Admission needs resource.k8s.io/v1 ResourceClaims, so clusters older
than Kubernetes 1.34 run without it unless the gate is on. Add the RBAC,
imex.maxChannels, the controller's API client limits, and a controller
update without a surge pod when leader election is off.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
With channel reservations, the controller rejects a claim with an
invalid channel config before its pod binds, so the misc ComputeDomain
tests check the controller instead of a failed Prepare, and skip the
partial Prepare test that such a claim can no longer reach.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
Add proposal 0001 and document spec.channels, the shared channel
device, claim admission, and upgrades.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
imex.mode and imex.scope were two halves of one choice, who runs the
IMEX daemons and for how long, and imex.isolation decided nothing that
the ComputeDomainChannelReservations gate and the ComputeDomain spec do
not. Replace them with imex.daemonLifecycle, perComputeDomain (default)
or hostManaged.

imex.mode and imex.isolation shipped in v0.5, so both stay as
deprecated values and flags. imex.mode=hostManaged still selects
hostManaged, a contradicting daemonLifecycle fails, and imex.isolation
is ignored. Helm prints a warning for each.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
… conditions

The shared channel device carried the ChannelAdmitted binding condition
in every mode, although only per-ComputeDomain IMEX daemons need it: the
controller may reject a claim of another ComputeDomain on a node, and the
scheduler must try another node before the pod binds. With host-managed
IMEX, ComputeDomains share nodes, so a rejection only reports a
configuration error, and the binding condition only made pods wait for
the channel. The scheduler checks binding conditions once, then every 5s,
so most pods waited 5s whenever the controller decided after the first
check, which depends on the order of the pod's claims.

The kubelet plugin now publishes the shared channel device without binding
conditions in a shared IMEX domain. Pods bind at once, and the controller
assigns their channels meanwhile, as it now admits shared channel devices
with or without binding conditions. Prepare reads the latest claim when
the channel is not assigned yet, and fails to be retried until it is, or
permanently with the controller's reason when it rejected the claim. A
channel is only used once assigned, so the controller still rebuilds every
channel in use after a restart.

Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Feature]: ComputeDomains: reserve IMEX channels so multiple workloads and ComputeDomains can safely share nodes

2 participants