Skip to content

feat(gpu-operator): add container variant for preinstalled host driver - #2766

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
feat/gpu-operator-container-variant
Jun 9, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
feat/gpu-operator-container-variant

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Add a third architectural variant to cozystack.gpu-operator for hosts where the NVIDIA driver and nvidia-container-toolkit are already installed by the distro package manager (the typical Ubuntu/Debian GPU node shape: apt-installed driver + apt-installed CT).

The existing variants do not produce a working setup in that shape. default (passthrough) runs vfioManager, which unbinds the host driver to bind vfio-pci — with the host driver active, k8s-driver-manager early-exits and the bind never happens, so the GPU never reaches a pod. vgpu requires the proprietary NVIDIA vGPU host driver and a license server; the user-installed open or proprietary driver does not satisfy it.

The new container variant maps onto upstream gpu-operator's third mode (sandboxWorkloads.enabled=false + devicePlugin.enabled=true) with every component that would conflict with the host install switched off:

  • driver.enabled=false — use the host driver.
  • toolkit.enabled=false — host already has nvidia-container-toolkit. Enabling the operator's toolkit DaemonSet would overwrite the /etc/containerd/config.toml the host package configured (via nvidia-ctk runtime configure), breaking the host runtime wiring. Matches NVIDIA's documented guidance and the existing examples/values-native-talos.yaml reference, which pins the same flag for the same reason.
  • devicePlugin.enabled=true — publish nvidia.com/gpu to the kubelet.
  • vfioManager.enabled=false — do not unbind the host driver. Upstream renders this true unconditionally; it only stays at zero pods because no node carries a vm-passthrough sandbox assignment when sandboxWorkloads is off — pinned off so the rendered policy matches intent.
  • cdi.enabled=false — upstream defaults this true, but CDI spec generation is serviced by the operator-managed toolkit DaemonSet this variant disables. An apt host doesn't auto-generate CDI specs (nvidia-ctk cdi generate is a manual step) and uses the classic nvidia-container-runtime hook, so leaving CDI on would point the device plugin at CDI injection with no specs on the host and silently break allocation.
  • sandboxWorkloads.enabled=false — regular pod workloads, not VMs. With this off, upstream defaultWorkload is already container, so no override is needed.

Host prerequisite: because the operator's toolkit component is disabled, the node's containerd must already have the nvidia runtime registered (nvidia-ctk runtime configure --runtime=containerd); apt install nvidia-container-toolkit installs binaries only and does not wire containerd. With driver.enabled=false the operator uses the pre-installed host driver at its standard location, so a stock apt install needs no hostPaths.driverInstallDir override (Talos lands the driver under a non-standard prefix — see examples/values-native-talos.yaml).

The bundle wiring (packages/core/platform/templates/bundles/iaas.yaml) already enables cozystack.gpu-operator as an optional package — no bundle changes required. Users opt into this variant by setting variant: container in their Package CR.

Verified locally with helm template against values.yaml + values-container.yaml: ClusterPolicy renders with driver.enabled=false, toolkit.enabled=false, devicePlugin.enabled=true, vfioManager.enabled=false, cdi.enabled=false, sandboxWorkloads.enabled=false. Platform helm unittest and the gpu-operator variant bats suite are green. Not yet smoke-tested on a real Ubuntu GPU node — the config matches the documented apt-host wiring (legacy nvidia-container-runtime hook, CDI off), but an end-to-end CUDA-pod run on hardware is still owed.

Closes #2764

Release note

feat(gpu-operator): add `container` variant for hosts with a pre-installed NVIDIA driver and nvidia-container-toolkit, exposing containerized GPU workloads via the standard NVIDIA device plugin without VFIO passthrough or vGPU.

Summary by CodeRabbit

  • New Features

    • Added a "container" GPU operator variant to support containerized GPU workloads on hosts with the NVIDIA driver and nvidia-container-toolkit.
  • Documentation

    • Updated variants documentation and OS support table to include the container variant and per-host requirements (including Ubuntu and Talos notes).
    • Clarified Talos native pod example wording.
  • Tests

    • Added regression tests to verify container-variant configuration and component enablement/disablement.

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new container variant to the GPU Operator package that assumes a host-installed NVIDIA driver and nvidia-container-toolkit: operator-managed driver/toolkit/vfio and CDI are disabled, sandbox workloads are off, and the device plugin is enabled; platform registration, tests, and docs are updated.

Changes

Container Variant for Pre-Installed NVIDIA Drivers

Layer / File(s) Summary
Container variant configuration values
packages/system/gpu-operator/values-container.yaml, packages/system/gpu-operator/values.yaml
values-container.yaml disables driver, toolkit, vfioManager, and sandboxWorkloads, and enables devicePlugin. values.yaml adds a top-level comment that its defaults apply to all variants.
Platform variant registration
packages/core/platform/sources/gpu-operator.yaml
Adds a container entry to spec.variants[] with dependsOn: [cozystack.networking], components pointing to system/gpu-operator, valuesFiles: [values.yaml, values-container.yaml], and install settings (privileged: true, namespace: cozy-gpu-operator, releaseName: gpu-operator).
Test coverage for container variant
hack/check-gpu-operator-variants.bats
Expanded regression description and added Bats tests asserting container variant rendered output: ccManager/vgpuDeviceManager pinned off; sandboxWorkloads.enabled: false with defaultWorkload: container; driver, toolkit, vfioManager disabled while devicePlugin is enabled; and cdi disabled.
Documentation and examples
docs/gpu-vgpu.md, packages/system/gpu-operator/examples/README.md
Variants section updated to include container and OS support table gains a container column with Ubuntu/Talos notes; example README paragraphs reflowed for clarity (no behavior changes).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #2764: feat(gpu-operator): add container variant for hosts with a pre-installed NVIDIA driver

Suggested labels

area/kubernetes

Suggested reviewers

  • androndo
  • sircthulhu
  • lllamnyp
  • IvanHunters
  • myasnikovdaniil

Poem

🐰 A container wakes where GPUs hum,
Host drivers ready, no VFIO drum,
Device plugin whispers nvidia.com/gpu,
Pods claim CUDA lanes, fast and true,
Rabbit hops — deploy anew!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately and concisely describes the main change: adding a container variant to the GPU Operator for hosts with pre-installed NVIDIA drivers.
Linked Issues check ✅ Passed All coding objectives from issue #2764 are met: new container variant added to gpu-operator.yaml, values-container.yaml created with required configurations (driver/toolkit/vfioManager disabled, devicePlugin/sandboxWorkloads correctly configured), variant entry added to PackageSource, and comprehensive test coverage added.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the container variant: documentation updates (gpu-vgpu.md, README.md), test coverage (check-gpu-operator-variants.bats), configuration files (values.yaml comment clarification), and variant implementation files are all in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/gpu-operator-container-variant

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added area/virtualization Issues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import) kind/feature Categorizes issue or PR as related to a new feature size/M This PR changes 30-99 lines, ignoring generated files labels May 28, 2026
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the feat/gpu-operator-container-variant branch from 90a826f to dcec3cb Compare May 28, 2026 17:07
@github-actions github-actions Bot added size/L This PR changes 100-499 lines, ignoring generated files and removed size/M This PR changes 30-99 lines, ignoring generated files labels May 28, 2026
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the feat/gpu-operator-container-variant branch from dcec3cb to 7c8a254 Compare May 28, 2026 17:17
@lexfrei
Aleksei Sviridkin (lexfrei) marked this pull request as ready for review May 28, 2026 17:43
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request adds a 'container' variant to the cozystack.gpu-operator package. This variant is specifically tailored for environments like Ubuntu/Debian where NVIDIA drivers and the container toolkit are pre-installed via system packages. By disabling conflicting operator components like the driver manager and vfioManager, it allows the operator to focus on publishing GPU resources to the kubelet via the device plugin, providing a cleaner integration for standard containerized GPU workloads.

Highlights

  • New 'container' variant: Introduced a third architectural variant for the gpu-operator, designed for hosts where the NVIDIA driver and nvidia-container-toolkit are already managed by the system package manager.
  • Configuration updates: Added values-container.yaml to explicitly disable driver, toolkit, and vfioManager components while enabling the device plugin, ensuring the operator does not conflict with host-level installations.
  • Documentation and Testing: Updated documentation in docs/gpu-vgpu.md and examples/README.md to reflect the new variant and added comprehensive BATS tests to prevent regressions in the new configuration.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new container variant for the gpu-operator package, designed for running containerized GPU workloads on hosts that already have the NVIDIA driver and nvidia-container-toolkit pre-installed. The changes include adding the values-container.yaml configuration, updating the platform sources, expanding the documentation, and adding BATS tests to verify the configuration of the new variant. There are no review comments, and I have no feedback to provide.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/system/gpu-operator/values-container.yaml (1)

8-15: ⚡ Quick win

Consider setting defaultWorkload: container explicitly for defense in depth.

The comment explains that no override is needed because upstream defaults to 'container' when sandboxWorkloads is disabled. While this is correct and intentional, explicitly setting defaultWorkload: container would defend against upstream behavior changes (e.g., if NVIDIA changes the default in a future chart version).

The test at hack/check-gpu-operator-variants.bats:120 validates this assumption, so a regression would be caught, but setting it explicitly would prevent the breakage in the first place.

🛡️ Proposed defensive addition
 gpu-operator:
   sandboxWorkloads:
-    # Default upstream workload on a node without the per-node
-    # 'nvidia.com/gpu.workload.config' label is 'container' when
-    # sandboxWorkloads is off — which is exactly what this variant
-    # wants. No defaultWorkload override needed; the counterpart
-    # overrides in values-passthrough.yaml / values-vgpu.yaml exist
-    # only because those variants flip sandboxWorkloads to true.
     enabled: false
+    # Explicitly pin to 'container' for defense in depth, even though
+    # it matches the upstream default when sandboxWorkloads is off.
+    # Protects against upstream changing the fallback behavior.
+    defaultWorkload: container
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/gpu-operator/values-container.yaml` around lines 8 - 15, Add
an explicit defaultWorkload: container to the sandboxWorkloads block in
values-container.yaml to harden against upstream default changes; locate the
sandboxWorkloads: enabled: false stanza and add the defaultWorkload: container
key alongside enabled so the GPU operator variant explicitly enforces container
workload behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/system/gpu-operator/values-container.yaml`:
- Around line 8-15: Add an explicit defaultWorkload: container to the
sandboxWorkloads block in values-container.yaml to harden against upstream
default changes; locate the sandboxWorkloads: enabled: false stanza and add the
defaultWorkload: container key alongside enabled so the GPU operator variant
explicitly enforces container workload behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4205e2d7-52cc-49d4-a30e-fc250e091250

📥 Commits

Reviewing files that changed from the base of the PR and between 67ba252 and 7c8a254.

📒 Files selected for processing (6)
  • docs/gpu-vgpu.md
  • hack/check-gpu-operator-variants.bats
  • packages/core/platform/sources/gpu-operator.yaml
  • packages/system/gpu-operator/examples/README.md
  • packages/system/gpu-operator/values-container.yaml
  • packages/system/gpu-operator/values.yaml

Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request May 28, 2026
Document the new container variant of cozystack.gpu-operator, paired with
cozystack/cozystack#2766. Covers the apt-installed-driver-and-toolkit
Linux shape that the variant targets: when to pick it over the
passthrough and vGPU variants, prerequisites (host driver + host
nvidia-container-toolkit, validated via nvidia-smi over kubectl debug),
the operator-validator host-driver auto-detect path
(/host/usr/bin/nvidia-smi), Talos caveat with a pointer to the
values-native-talos.yaml reference, install steps, a sample CUDA pod for
verification, the variant comparison matrix, and a cross-reference to
the HAMi sharing guide for tenant Kubernetes clusters.

Lands under operations/ — symmetric with virtualization/gpu.md (VM
passthrough on management cluster) and kubernetes/gpu-sharing.md (HAMi
in tenant Kubernetes addons).

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the feat/gpu-operator-container-variant branch from 7c8a254 to b9243a0 Compare June 2, 2026 23:00
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request Jun 5, 2026
Document the new container variant of cozystack.gpu-operator, paired with
cozystack/cozystack#2766. Covers the apt-installed-driver-and-toolkit
Linux shape that the variant targets: when to pick it over the
passthrough and vGPU variants, prerequisites (host driver + host
nvidia-container-toolkit, validated via nvidia-smi over kubectl debug),
the operator-validator host-driver auto-detect path
(/host/usr/bin/nvidia-smi), Talos caveat with a pointer to the
values-native-talos.yaml reference, install steps, a sample CUDA pod for
verification, the variant comparison matrix, and a cross-reference to
the HAMi sharing guide for tenant Kubernetes clusters.

Lands under operations/ — symmetric with virtualization/gpu.md (VM
passthrough on management cluster) and kubernetes/gpu-sharing.md (HAMi
in tenant Kubernetes addons).

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>

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

Summary

This adds a third gpu-operator variant, container, for hosts that already ship the NVIDIA driver and nvidia-container-toolkit (the apt-installed Ubuntu/Debian shape), where neither default (VFIO passthrough, which unbinds the host driver) nor vgpu (proprietary SR-IOV stack) can serve plain CUDA pods. It maps onto upstream's standard container-workload mode (sandboxWorkloads.enabled=false + devicePlugin.enabled=true) with driver/toolkit/vfioManager off so the operator doesn't fight the host install — essentially a first-class promotion of the proven examples/values-native-talos.yaml config minus the Talos driverInstallDir workaround. The change is additive and opt-in (variant: container), with a new values overlay, a mirrored PackageSource entry, three new bats regression tests, and docs updates. Structure and consistency with the existing two variants are correct, and nothing here can regress current default/vgpu users.

The substantive concerns are narrow: (1) the variant inherits cdi.enabled=true from the upstream chart while disabling the toolkit that normally services CDI — the most likely way it doesn't actually work on the target shape; (2) one values comment states a wrong upstream default; and (3) the docs understate the host prerequisites (an apt install does not configure containerd). The bats tests and the PackageSource/bundle wiring are sound. Requesting changes for items 1–3 plus a real-node smoke test before merge — details inline and in the verification list below.

NEEDS ENGINEER VERIFICATION

The gating logic lives in the operator/validator images, not the chart, and the PR states verification was helm template + unit tests only:

  1. End-to-end on the target shape. Deploy variant: container on a real Ubuntu node (apt driver + toolkit) and confirm a CUDA pod schedules and runs nvidia-smi:
    kubectl -n cozy-gpu-operator get pods -o wide
    kubectl -n cozy-gpu-operator logs ds/nvidia-operator-validator -c driver-validation
    kubectl -n cozy-gpu-operator logs ds/nvidia-operator-validator -c toolkit-validation
    kubectl get node <gpu-node> -o jsonpath='{.status.allocatable.nvidia\.com/gpu}'
    
  2. CDI behavior with an unmanaged toolkit (see inline). Confirm what the operator does with the rendered cdi.enabled: true when toolkit.enabled=false:
    kubectl get clusterpolicy cluster-policy -o yaml | grep -A3 'cdi:'
    ls /var/run/cdi /etc/cdi 2>/dev/null   # on the host
    
  3. Validator host-driver auto-detect claim. examples/README.md asserts the validator probes /host/usr/bin/nvidia-smi when driver.enabled=false, while the default driverInstallDir is /run/nvidia/driver. Confirm via the driver-validation init-container logs or the v26.3.1 validator source.

Recommendation: request changes — items 1–3 are quick edits; item 1's inline + the smoke test are what stand between "renders correctly" and "works on the host shape it targets".

# binding must not happen. Upstream defaults this to off when
# sandboxWorkloads is disabled, but the explicit pin protects
# against an upstream default flip.
enabled: false

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.

The comment states "Upstream defaults this to off when sandboxWorkloads is disabled" — that's not accurate at the chart level. The upstream v26.3.1 default is vfioManager.enabled: true unconditionally (charts/gpu-operator/values.yaml:469-470), and the template renders it verbatim with no sandboxWorkloads gating (charts/gpu-operator/templates/clusterpolicy.yaml:342-343). The repo's own passthrough bats test even asserts the rendered value is true with no override.

What's actually true: vfio-manager only schedules onto nodes labeled nvidia.com/gpu.workload.config=vm-passthrough, and with sandboxWorkloads.enabled=false no node ever gets a sandbox assignment — so the DaemonSet stays at zero pods, it isn't "defaulted off." The pin is correct and worth keeping; please fix the rationale so it doesn't mislead the next chart-bump audit:

  vfioManager:
    # Defensive: vfioManager unbinds the host driver to bind vfio-pci.
    # Upstream still renders vfioManager.enabled=true into the
    # ClusterPolicy; it only stays at zero pods because no node carries
    # a sandbox workload assignment when sandboxWorkloads is off. Pin it
    # off so the rendered policy matches intent regardless of upstream
    # scheduling changes.
    enabled: false

enabled: false
devicePlugin:
# Publish nvidia.com/gpu to the kubelet so pods can request GPUs.
enabled: true

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.

Functional risk — please verify or pin. The upstream v26.3.1 chart defaults cdi.enabled: true (charts/gpu-operator/values.yaml:15-16), and neither the base values.yaml nor this overlay touches it, so this variant's ClusterPolicy renders with CDI on. In operator-managed deployments, CDI spec generation and runtime wiring are done by the toolkit container — which this variant disables. An apt-installed nvidia-container-toolkit does not generate CDI specs on its own (nvidia-ctk cdi generate is a manual step). So cdi.enabled=true + toolkit.enabled=false on exactly the target host shape may silently degrade or break device-plugin allocation.

Note the Talos example "worked" with the same inherited value only because the Talos extension wires its own hooks — that result doesn't transfer to the apt shape. Either pin it off:

  cdi:
    # Upstream defaults cdi.enabled=true, but CDI spec generation is
    # serviced by the operator-managed toolkit, which this variant
    # disables. The apt host toolkit uses the classic
    # nvidia-container-runtime hook path, not CDI. Pin off so device
    # allocation matches the host wiring.
    enabled: false

…or, if you have evidence the operator ignores cdi.enabled when the toolkit is unmanaged, put that in the comment instead. It needs to be one or the other — right now it's an untested inheritance.

Comment thread docs/gpu-vgpu.md Outdated

- **`default`** — passthrough mode (`vfio-pci`). Whole GPU goes to a single VM. Talos is supported here; the kernel module is the open-source `vfio-pci`, no proprietary driver is needed on the host.
- **`vgpu`** — SR-IOV vGPU mode. One physical GPU is sliced into multiple VFs, each VF bound to a vGPU profile that the guest sees as its own GPU.
- **`container`** — containerized GPU workloads (CUDA pods, ML training) via the standard NVIDIA device plugin on hosts that already provide both the NVIDIA driver and `nvidia-container-toolkit` (the typical apt-installed Ubuntu/Debian shape). Sandbox workloads are off, `devicePlugin` is on, `driver` / `toolkit` / `vfioManager` are off so that the operator does not fight the host install. Orthogonal to the two VM variants — it does not pass GPUs to KubeVirt VMs.

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.

Prerequisites are understated here (and the same wording in the PR body). apt install nvidia-container-toolkit installs binaries only — it does not configure containerd. For the device plugin to get NVML access and for the operator-validator's toolkit check to pass, the host must additionally have run nvidia-ctk runtime configure --runtime=containerd (+ containerd restart) and either set nvidia as the default runtime or expose it via a RuntimeClass. The operator's toolkit component normally does this wiring, and it's disabled in this variant. Suggest making it explicit:

- **`container`** — ... Requires the host to provide the NVIDIA driver,
  `nvidia-container-toolkit`, **and** a containerd configured with the
  `nvidia` runtime (`nvidia-ctk runtime configure --runtime=containerd`,
  set as default or via a RuntimeClass). The operator's toolkit
  component — which normally does this wiring — is disabled here.

Related: the PR body's claim that the operator toolkit "would overwrite … the CDI hooks the host package wired up" repeats a misconception — the apt package wires no CDI hooks (see the cdi.enabled thread on values-container.yaml).

Talos.
The files in this directory are **not** templates. They are reference artifacts that document one working configuration for running GPU workloads directly in pods on a Talos-based Cozystack cluster, together with the DCGM metrics needed by the `gpu/gpu-performance` Grafana dashboard.

For non-Talos Linux hosts that already provide the NVIDIA driver and `nvidia-container-toolkit` via the distro package manager (the typical apt-installed Ubuntu/Debian shape), pick the first-class `container` variant instead — `variant: container` in your Package CR is enough and no `hostPaths.driverInstallDir` override is needed because the operator-validator auto-detects the host driver at `/host/usr/bin/nvidia-smi`. The files here remain the right starting point on Talos, where the extension installs `nvidia-smi` at `/usr/local/bin/` and the auto-detect path misses 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.

Two things to verify/qualify in this paragraph:

  1. "variant: container ... is enough" — same gap as the vGPU doc: it's enough only if the host's containerd is already configured for the nvidia runtime. An apt toolkit install alone is not sufficient. Worth a one-line caveat here too.
  2. Auto-detect path claim — "the operator-validator auto-detects the host driver at /host/usr/bin/nvidia-smi" is an assertion about validator-internal behavior that isn't visible in this repo; the chart's default hostPaths.driverInstallDir is /run/nvidia/driver. Please confirm against the v26.3.1 validator (or the driver-validation init-container logs on a real node) before stating it as fact, since the whole "no override needed on Ubuntu" claim rests on it.

The two existing variants assume the host has neither the NVIDIA driver
nor the container toolkit: default unbinds the host driver to bind
vfio-pci for KubeVirt VMs, vgpu requires the proprietary vGPU host
driver and a license server. Neither path produces a working setup on a
node that already ships the driver and nvidia-container-toolkit via the
distro package manager — the most common shape of a Linux GPU node.

The new container variant surfaces the third architectural mode that
upstream NVIDIA gpu-operator already supports: sandboxWorkloads
disabled, devicePlugin enabled, with every component that would
conflict with the host install switched off.

- driver.enabled=false        use the host driver
- toolkit.enabled=false       host already has nvidia-container-toolkit;
                              enabling overwrites the containerd
                              config.toml the host configured via
                              nvidia-ctk runtime configure
- devicePlugin.enabled=true   publish nvidia.com/gpu to the kubelet
- vfioManager.enabled=false   do not unbind the host driver
- cdi.enabled=false           CDI spec generation is serviced by the
                              disabled toolkit; an apt host uses the
                              legacy nvidia-container-runtime hook, so
                              pin off to match the host runtime wiring
- sandboxWorkloads.enabled=false   regular pod workloads, not VMs

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei
Aleksei Sviridkin (lexfrei) force-pushed the feat/gpu-operator-container-variant branch from b9243a0 to 9352d3e Compare June 8, 2026 14:10
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request Jun 8, 2026
Document the new container variant of cozystack.gpu-operator, paired with
cozystack/cozystack#2766. Covers the apt-installed-driver-and-toolkit
Linux shape that the variant targets: when to pick it over the
passthrough and vGPU variants, prerequisites (host driver + host
nvidia-container-toolkit registered with containerd via
nvidia-ctk runtime configure, validated with nvidia-smi over
kubectl debug), the host-driver reuse path (driver.enabled=false, so the
operator uses the pre-installed driver at its standard location with no
driverInstallDir override needed on a stock apt install), the Talos
caveat with a pointer to the values-native-talos.yaml reference, install
steps, a sample CUDA pod for verification, the variant comparison
matrix, and a note on why stacking HAMi directly on the container
variant on the management cluster is not a supported combination yet
(both register nvidia.com/gpu).

Lands under operations/ — symmetric with virtualization/gpu.md (VM
passthrough on management cluster) and kubernetes/gpu-sharing.md (HAMi
in tenant Kubernetes addons).

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review — all four points are addressed in the latest push.

  1. cdi.enabled — pinned false in values-container.yaml. You were right that this was untested inheritance: upstream defaults it true, CDI spec generation is serviced by the toolkit DaemonSet this variant disables, and an apt host doesn't auto-generate CDI specs (nvidia-ctk cdi generate is manual) — it uses the classic nvidia-container-runtime hook. Leaving CDI on would have pointed the device plugin at CDI injection with no specs on the host. Pinned off, with a bats assertion guarding the regression.
  2. vfioManager comment — rewritten. The old rationale ("upstream defaults off when sandboxWorkloads is disabled") was wrong; upstream renders vfioManager.enabled=true unconditionally and it only stays at zero pods because no node carries a vm-passthrough sandbox assignment. The comment now says exactly that.
  3. Host prerequisites (docs + PR body) — now state that apt install nvidia-container-toolkit lays down binaries only and the host must additionally run nvidia-ctk runtime configure --runtime=containerd. The "CDI hooks the host package wired up" phrasing — a misconception, the apt package wires no CDI hooks — is removed from the values comment and the PR body.
  4. Validator auto-detect path — dropped the /host/usr/bin/nvidia-smi assertion (validator-internal, not verifiable from the chart) in examples/README.md and docs/gpu-vgpu.md. Reframed to the chart-grounded contract: with driver.enabled=false the operator uses the pre-installed host driver at its standard location, so a stock apt install needs no hostPaths.driverInstallDir override; Talos needs it (non-standard prefix).

On the smoke test (item 1): I have not run it on a real Ubuntu GPU node — no hardware on hand. The config now matches the documented apt-host wiring (legacy nvidia-container-runtime hook, CDI off) and every chart-level claim is verified against the vendored v26.3.1 chart, the rendered ClusterPolicy, and the bats suite — but an end-to-end CUDA-pod run is still owed. If anyone has a node I'm happy to coordinate or hand over a checklist.

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. All three substantive items from the earlier review are addressed in the post-review commit: cdi.enabled: false is pinned with the corrected rationale, the vfioManager comment is rewritten to reflect that upstream renders it unconditionally (zero pods only because of the vm-passthrough node selector), and the docs now state that apt install nvidia-container-toolkit installs binaries only and the host must run nvidia-ctk runtime configure --runtime=containerd. New bats test pins cdi off. CI green.

One thing not provable from the diff: a real-node smoke test of a CUDA pod on a container-variant host (the prior review gated partly on this). If that's been done out-of-band, this is good to go from my side.

Note: this and #2767/#2768 all edit docs/gpu-vgpu.md — whichever lands later will need a docs rebase.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit b610803 into main Jun 9, 2026
11 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the feat/gpu-operator-container-variant branch June 9, 2026 23:01
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request Jun 22, 2026
Document the new container variant of cozystack.gpu-operator, paired with
cozystack/cozystack#2766. Covers the apt-installed-driver-and-toolkit
Linux shape that the variant targets: when to pick it over the
passthrough and vGPU variants, prerequisites (host driver + host
nvidia-container-toolkit registered with containerd via
nvidia-ctk runtime configure, validated with nvidia-smi over
kubectl debug), the host-driver reuse path (driver.enabled=false, so the
operator uses the pre-installed driver at its standard location with no
driverInstallDir override needed on a stock apt install), the Talos
caveat with a pointer to the values-native-talos.yaml reference, install
steps, a sample CUDA pod for verification, the variant comparison
matrix, and a note on why stacking HAMi directly on the container
variant on the management cluster is not a supported combination yet
(both register nvidia.com/gpu).

Lands under operations/ — symmetric with virtualization/gpu.md (VM
passthrough on management cluster) and kubernetes/gpu-sharing.md (HAMi
in tenant Kubernetes addons).

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request Jul 1, 2026
Document the new container variant of cozystack.gpu-operator, paired with
cozystack/cozystack#2766. Covers the apt-installed-driver-and-toolkit
Linux shape that the variant targets: when to pick it over the
passthrough and vGPU variants, prerequisites (host driver + host
nvidia-container-toolkit registered with containerd via
nvidia-ctk runtime configure, validated with nvidia-smi over
kubectl debug), the host-driver reuse path (driver.enabled=false, so the
operator uses the pre-installed driver at its standard location with no
driverInstallDir override needed on a stock apt install), the Talos
caveat with a pointer to the values-native-talos.yaml reference, install
steps, a sample CUDA pod for verification, the variant comparison
matrix, and a note on why stacking HAMi directly on the container
variant on the management cluster is not a supported combination yet
(both register nvidia.com/gpu).

Lands under operations/ — symmetric with virtualization/gpu.md (VM
passthrough on management cluster) and kubernetes/gpu-sharing.md (HAMi
in tenant Kubernetes addons).

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request Jul 3, 2026
## What this PR does

Add a new operations guide describing the `container` variant of
`cozystack.gpu-operator` — the architectural mode for containerized GPU
workloads (CUDA pods, ML training, inference) on Linux GPU nodes that
already ship the NVIDIA driver and `nvidia-container-toolkit` via the
distro package manager.

The new page lands at
`content/en/docs/next/operations/gpu-container-workloads.md` and rounds
out the GPU documentation surface:

- [Running VMs with GPU Passthrough](/docs/next/virtualization/gpu/) —
VFIO passthrough of whole GPUs to KubeVirt VMs (`default` variant).
- [GPU Sharing with HAMi](/docs/next/kubernetes/gpu-sharing/) —
fractional GPU sharing in tenant Kubernetes clusters.
- **[Running Containerized GPU
Workloads](/docs/next/operations/gpu-container-workloads/)** — this
page. Containerized GPU workloads on management nodes (`container`
variant).

Content covers when to pick the variant (host driver + host toolkit + a
containerd-registered `nvidia` runtime prerequisite), the host-driver
reuse path (`driver.enabled=false`, so the operator uses the
pre-installed driver at its standard location with no `driverInstallDir`
override on a stock apt install), the Talos caveat with a pointer to the
`examples/values-native-talos.yaml` reference, install steps with
`Package` CR `variant: container`, a sample CUDA pod for verification,
why stacking HAMi directly on this variant is not supported yet, and a
three-row variant comparison matrix.

Companion to cozystack/cozystack#2766, which adds the `container`
variant itself.

### Release note

```release-note
docs(operations): add guide for containerized GPU workloads via the gpu-operator `container` variant.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* New guide for running containerized GPU workloads on cluster nodes:
prerequisites, installation via the Package CR, explicit warning against
using bundles.enabledPackages for this variant, operator health and GPU
allocatable verification, sample CUDA Pod workflow, fractional GPU
sharing via HAMi, and a comparison of container, default (VM
passthrough), and vGPU variants.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
myasnikovdaniil added a commit to cozystack/website that referenced this pull request Aug 17, 2026
These four guides were written into cozystack/cozystack under `docs/`
inside the feature PRs that added the code, and never routed anywhere a
user looks. They are operator facing how-tos with no reason to sit in
the source tree, so I moved them here, into both `next/` and `v1.6/`.

### New pages

- `virtualization/vgpu.md` - NVIDIA vGPU on the vgpu variant: two host
driver models, building the vGPU Manager image, SR-IOV profile
assignment, DLS licensing, L40S profile table, OS support.
- `operations/troubleshooting/gpu-operator-host-driver.md` - passthrough
variant refusing to bind vfio-pci when the host already carries an apt
installed driver. This was a 120 line runbook wedged inside the vGPU
guide, it is its own problem so it gets its own page.
- `networking/vm-external-vlan.md` - bridging a VM onto a physically
routed VLAN, and why macvlan does not work with kubevirt bridge binding.
- `networking/hubble.md` - enabling hubble, plus the four dashboards
cozystack ships for it.

Dropped stale content instead of carrying it over: a "Last verified ...
this PR's vgpu variant" stamp, and two claims that the container variant
is unmerged (it landed in cozystack/cozystack#2766 last June, so the
runbook points at it as the no-purge alternative now). Rechecked
NVIDIA/k8s-driver-manager#191, still open.

Two fixes to existing pages while wiring the links.
`virtualization/gpu.md` said vGPU uses mediated devices, that is only
true up to Ampere, Ada Lovelace and newer use SR-IOV virtual functions.
And the hubble dashboards come from `dashboards-infra.list`, which
renders only for tenant-root and cozy-monitoring, so they appear in the
platform grafana and not in a tenant's own.

The CNI plugin staging contract that shared the vm-external-vlan
document stays in cozystack/cozystack as
`packages/system/multus/README.md`, because a bats suite asserts its
prose against the Dockerfile and the manifest. Deletion of the originals
is a separate PR there, i'll link it once it is open.
Aleksei Sviridkin (lexfrei) added a commit that referenced this pull request Sep 6, 2026
The container variant landed in #2766 on 2026-06-09. That change
updated the Variants section and the OS support table but left two
passages untouched, both written a fortnight earlier while the variant
was still a pull request. The passthrough host-preparation section
called it "not part of the current package", and the known-limitation
list headed it "not yet merged" under a sentence promising that
neither listed path was available yet. A reader working through the
passthrough purge workaround was told the no-purge alternative did not
exist.

Say instead that the variant ships, and name the part that is easy to
get wrong when reaching for it: bundles.iaas.gpuOperatorVariant
rejects "container" by design, so selecting it goes through
bundles.disabledPackages plus a hand-written Package CR.

The Last verified line at the top of the file carried the same
PR-relative framing for the vgpu variant, which is also a registered
variant now. Name it plainly; on main there is no "this PR" for a
reader to resolve.

The upstream guard the section documents is unchanged. The container
variant sidesteps isHostDriver rather than fixing it, so passthrough
on a host with a pre-installed driver still needs the purge.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei) added a commit that referenced this pull request Sep 6, 2026
The container variant landed in #2766 on 2026-06-09. That change
updated the Variants section and the OS support table but left two
passages untouched, both written a fortnight earlier while the variant
was still a pull request. The passthrough host-preparation section
called it "not part of the current package", and the known-limitation
list headed it "not yet merged" under a sentence promising that
neither listed path was available yet. A reader working through the
passthrough purge workaround was told the no-purge alternative did not
exist.

Say instead that the variant ships, and name the part that is easy to
get wrong when reaching for it: bundles.iaas.gpuOperatorVariant
rejects "container" by design, so selecting it goes through
bundles.disabledPackages plus a hand-written Package CR.

The Last verified line at the top of the file carried the same
PR-relative framing for the vgpu variant, which is also a registered
variant now. Name it plainly; on main there is no "this PR" for a
reader to resolve.

The upstream guard the section documents is unchanged. The container
variant sidesteps isHostDriver rather than fixing it, so passthrough
on a host with a pre-installed driver still needs the purge.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei) added a commit that referenced this pull request Sep 6, 2026
The container variant shipped in #2766 on 2026-06-09. Two passages in
this file still described it as unreleased: the passthrough
host-preparation section called it "not part of the current package",
and the known-limitation list headed it "not yet merged" under a
sentence promising that neither listed path was available yet. A
reader working through the passthrough purge workaround was told the
no-purge alternative did not exist.

The two changes crossed in flight rather than one missing the other.
#2766 updated the document as it then stood. The stale passages were
written on 2026-05-28 while it was still open and landed eleven
minutes behind it, already out of date on arrival.

Say instead that the variant ships, and name the part that is easy to
get wrong when reaching for it: bundles.iaas.gpuOperatorVariant
rejects "container" by design, so selecting it goes through
bundles.disabledPackages plus a Package CR under that same name,
which is how a Package resolves its source.

The Last verified line at the top of the file carried the same
PR-relative framing for the vgpu variant, which is a registered
variant now too. Name it plainly; on main there is no "this PR" for a
reader to resolve.

The upstream guard the section documents is unchanged. The container
variant sidesteps isHostDriver rather than fixing it, so passthrough
on a host with a pre-installed driver still needs the purge.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/virtualization Issues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import) kind/feature Categorizes issue or PR as related to a new feature size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gpu-operator): add container variant for hosts with a pre-installed NVIDIA driver

3 participants