Skip to content

fix: clean up mismatched prebaked GPU drivers - #8915

Closed
djsly wants to merge 1 commit into
mainfrom
djsly-fix-grid-driver-cleanup
Closed

fix: clean up mismatched prebaked GPU drivers#8915
djsly wants to merge 1 commit into
mainfrom
djsly-fix-grid-driver-cleanup

Conversation

@djsly

@djsly djsly commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Fixes Ubuntu GRID GPU nodes that can otherwise keep a CUDA driver prebaked into the VHD when CSE dynamically installs a GRID driver. The CSE now reads the prebake marker before managed GPU driver installation, normalizes the prebaked and requested driver families, and invokes the existing prebaked driver cleanup path when they do not match.

Legacy markers without driver_kind are treated as CUDA prebake only for GRID requests. This is intentionally driver-family aware only; CUDA-vs-CUDA version drift still needs separate marker/version comparison work.

Validation:

  • Focused ShellSpec coverage for absent markers, CUDA-to-GRID cleanup, legacy GRID cleanup, and matching CUDA no-op passed with bash.
  • GENERATE_TEST_DATA=true go test ./pkg/agent... passed.
  • Full make generate is blocked by internal Go proxy authorization while installing ginkgo.

Which issue(s) this PR fixes:

N/A

🤖 Generated by GitHub Copilot

Ensure Ubuntu managed GPU driver installation removes a prebaked GPU driver when its marker indicates a different driver family than the requested node driver. This prevents GRID scenarios from keeping the prebaked CUDA driver alongside a dynamically installed GRID driver.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4110a607-c4e2-49f0-b023-5b5f73cfb153

Copilot AI 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.

Pull request overview

This PR improves Ubuntu GPU node provisioning when a shared VHD has a prebaked NVIDIA driver that doesn’t match the managed driver family requested by CSE (notably CUDA prebake + managed GRID install). It adds marker parsing + driver-kind normalization, and triggers the existing prebaked-driver teardown path when a mismatch is detected.

Changes:

  • Add helper functions to normalize NVIDIA_GPU_DRIVER_TYPE → driver kind and to read driver_kind from the prebake marker.
  • Add cleanUpMismatchedPrebakedGPUDriver and invoke it early in ensureGPUDrivers on Ubuntu before managed driver installation.
  • Add ShellSpec coverage for absent markers, CUDA→GRID cleanup, legacy markers without driver_kind, and matching no-op behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh Adds focused ShellSpec tests validating mismatch cleanup behavior and edge cases.
parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh Updates the cleanUpPrebakedGPUDriver header comment to reflect its expanded use cases.
parts/linux/cloud-init/artifacts/cse_config.sh Introduces driver-kind/marker helpers and runs mismatch cleanup before managed GPU driver installation on Ubuntu.

Comment on lines +234 to +238
# cleanUpPrebakedGPUDriver removes a driver pre-baked into the shared VHD on nodes that should not
# keep it: non-GPU VMs, GPU VMs opted out via --gpu-driver None or skip toggles, and managed GPU
# nodes whose requested driver kind does not match the prebaked driver marker. There the driver is
# either dead weight (wasted disk; nvidia.ko rebuilt on every kernel patch), unused attack surface, or
# the wrong driver family for the node SKU. No-op unless the marker exists.
@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=172045051
Failed jobs/stages/tasks: build2204gen2containerd, build2004fipsgen2containerd, and build2404gen2containerd / Test, Scan, and Cleanup.

Detective summary: Ubuntu 22.04 Gen2 containerd completed CIS assessment and failed baseline diff on 6.1.3.1|pass->fail. Ubuntu 24.04 Gen2 containerd completed CIS assessment and hit the known 6.1.4.1|pass->fail regression tracked by repair item #38529622. Ubuntu 20.04 FIPS Gen2 containerd passed sampled VHD content tests and skipped CIS as expected, but surfaced script exit 2 with the exact failing command not visible in sampled logs.

Likely cause / signatures: linux-vhd-prgate-cis-ubuntu2204-gen2-containerd-6131-pass-fail; linux-vhd-prgate-ubuntu2004-fips-gen2-containerd-exit2-unknown-surface; linux-vhd-prgate-cis-ubuntu2404-gen2-containerd-6141-pass-fail.

Confidence: High for the two CIS rule regressions; low/medium for the Ubuntu 20.04 FIPS unknown exit-2 surface.

Recommended owner/action: VHD/CIS owner should inspect the 22.04 6.1.3.1 and existing 24.04 6.1.4.1 baseline diffs. For 20.04 FIPS, fetch the full Test/Scan log around the non-zero command before assigning PR action.

Strongest alternative: PR #8915 GPU driver cleanup caused image content drift; possible but not proven for the CIS diffs and not supported for the 20.04 FIPS unknown surface from sampled logs.

Evidence: ADO build summary, Test/Scan logs 538/545, source commit 5bf68c1d48913da9027d1d811a76746c75a30ddd, associated commit d4a3625f7b7325eb10c4dfdae8448c63155181fd.

Wiki signatures: linux-vhd-prgate-cis-ubuntu2204-gen2-containerd-6131-pass-fail, linux-vhd-prgate-ubuntu2004-fips-gen2-containerd-exit2-unknown-surface, linux-vhd-prgate-cis-ubuntu2404-gen2-containerd-6141-pass-fail

@djsly

djsly commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

fixed in #8919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants