Skip to content

fix[device-plugin] add DEVICE_LIST_STRATEGY env var guardrail - #3081

Merged
tariq1890 merged 1 commit into
mainfrom
cdi-validate-device-list-strategy
Oct 21, 2026
Merged

tariq1890 merged 1 commit into
mainfrom
cdi-validate-device-list-strategy

Conversation

@tariq1890

@tariq1890 tariq1890 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

This commit adds additional validation to the devicePlugin operand transformation logic. When CDI is enabled, it is required that the DEVICE_LIST_STRATEGY env var value includes one of "cdi-annotations" and "cdi-cri". While the current transformation code adds these values to DEVICE_LIST_STRATEGY when .spec.cdi.enabled is true, the same resolved value gets overridden when the gpu-operator user sets the DEVICE_LIST_STRATEGY env var explicitly in the devicePlugin section of the ClusterPolicy custom resource.

This changes addresses a major limitation in the gpu-operator where feedback from an invalid devicePlugin config only happens at gpu pod workload scheduling which is a significant delay. This provides a poor UX as users waste hours debugging the containerCreate failures instead of identifying the invalid devicePlugin config. This fix changes that by failing at the ClusterPolicy reconcile stage.

@tariq1890
tariq1890 requested a review from a team as a code owner October 15, 2026 03:08
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

When CDI is enabled, TransformDevicePlugin now rejects a non-empty DEVICE_LIST_STRATEGY value if no comma-separated entry starts with cdi-. The new hasCDIDeviceListStrategy helper checks for such an entry.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 35602

An invalid CDI strategy can pass reconciliation and leave workloads with an unusable device-plugin configuration. Match the supported strategies exactly before merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

@tariq1890
tariq1890 force-pushed the cdi-validate-device-list-strategy branch from 35602f4 to a4ef034 Compare October 15, 2026 03:16
devin-ai-integration[bot]

This comment was marked as resolved.

@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 45.025% (+0.04%) from 44.983% — cdi-validate-device-list-strategy into main

@tariq1890
tariq1890 force-pushed the cdi-validate-device-list-strategy branch 2 times, most recently from 68f0eaf to 3270b24 Compare October 15, 2026 03:26
devin-ai-integration[bot]

This comment was marked as resolved.

@tariq1890
tariq1890 force-pushed the cdi-validate-device-list-strategy branch from 3270b24 to 44ce354 Compare October 15, 2026 03:48
Comment thread controllers/transforms_test.go Outdated
This commit adds additional validation to the devicePlugin operand
transformation logic. When CDI is enabled, it is required that the
DEVICE_LIST_STRATEGY env var value includes one of
"cdi-annotations" and "cdi-cri". While the current transformation code
adds these values to DEVICE_LIST_STRATEGY when .spec.cdi.enabled is true,
the same resolved value gets overridden when the gpu-operator user sets
the DEVICE_LIST_STRATEGY env var explicitly in the devicePlugin section
of the ClusterPolicy custom resource.

This changes addresses a major limitation in the gpu-operator where
feedback from an invalid devicePlugin config  only happens at gpu pod
workload scheduling which is a significant delay. This provides a poor
UX as users waste hours debugging the containerCreate failures instead
of identifying the invalid devicePlugin config. This fix changes that by
failing at the ClusterPolicy reconcile stage.

Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
@tariq1890
tariq1890 force-pushed the cdi-validate-device-list-strategy branch from 44ce354 to 54cc02c Compare October 15, 2026 04:42
@tariq1890 tariq1890 changed the title fix[device-plugin] add cdi validation guardrail fix[device-plugin] add DEVICE_LIST_STRATEGY env var guardrail Oct 15, 2026

@cdesiniotis cdesiniotis 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.

Long overdue!

@cdesiniotis

Copy link
Copy Markdown
Contributor

Backport to release-26.7?

@tariq1890

Copy link
Copy Markdown
Contributor Author

Backport to release-26.7?

Yes, I am open to this

@aditighag aditighag 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.

Thanks for picking this up.
Failing early instead of at pod creation time is a good improvement, but it doesn't fix the linked issue - #3077.
Please see inline review comments.

Separately, can we have similar guardrails for ACCEPT_NVIDIA_VISIBLE_DEVICES_AS_VOLUME_MOUNTS? Setting it alongside CDI is the main cause of #3077.

Comment thread controllers/object_controls.go
@tariq1890
tariq1890 merged commit 02ee32a into main Oct 21, 2026
22 checks passed
@tariq1890
tariq1890 deleted the cdi-validate-device-list-strategy branch October 21, 2026 22:03
@tariq1890

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-26.7

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport PR created for release-26.7: #3107 ✅

@rahulait rahulait added this to the v26.7.3 milestone Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants