Skip to content

fix: validate cache-only Ubuntu GPU images and preserve prerequisites - #9693

Open
Ganeshkumar Ashokavardhanan (ganeshkumarashok) wants to merge 4 commits into
mainfrom
ganesh/gpu-cache-only-shared-vhd
Open

Ganeshkumar Ashokavardhanan (ganeshkumarashok) wants to merge 4 commits into
mainfrom
ganesh/gpu-cache-only-shared-vhd

Conversation

@ganeshkumarashok

@ganeshkumarashok Ganeshkumar Ashokavardhanan (ganeshkumarashok) commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Follow up on merged #9694, which already stopped CUDA host prebaking in non-FIPS
Ubuntu 22.04/24.04 amd64 Gen2 shared VHDs. This PR adds explicit installer/boot
prerequisites and final-image cleanliness checks. It retains #9694's pipeline
defaults and CIS-report condition without additional pipeline changes.

This removes the need for CPU/opt-out CSE cleanup to prevent NVIDIA DKMS work
during kernel updates. It deliberately defers precompiled-module reuse rather
than adding a parking/restoration lifecycle or a coordinated aks-gpu producer
format change.

  • Test that all four shared-image build/release defaults remain FEATURE_FLAGS=None.
  • Preserve gcc/make/libc6-dev and the nouveau blacklist in all initramfs images
    independently of host prebaking.
  • Add final-image checks for active or dangling NVIDIA registration, markerless
    host residue, installed modules and initramfs copies.
  • Require the installer cache, booted-kernel headers and boot prerequisites.
  • Select the invariant by image identity, not the disabled feature flag.
  • Reject contaminated images instead of silently uninstalling their contents.

ARM64/Grace-Blackwell, FIPS, CVM and other OS image policies are unchanged.
Existing cleanup, container caching, PIS and nodePrep activation remain in place.
No aks-gpu image update is required.

Validation:

  • New producer fixtures plus existing VHD content helpers: 75 examples passed.
    Coverage includes all four pipeline defaults, image-family exclusions,
    dangling links, missing markers, compressed modules, alternate initramfs,
    prerequisite/cache failures and failed inspection.
  • The first VHD run 183950052
    built both target images but failed the new content check in both attempts
    per image. The matcher incorrectly classified Ubuntu's stock
    kernel/drivers/platform/x86/nvidia-wmi-ec-backlight.ko (compressed on 24.04)
    as CUDA/GRID residue. The corrected disk/initramfs checks exclude only that
    stock-kernel path. DKMS-path copies and GPU modules remain failures.
    Four new regression cases first reproduced the failure, then passed;
    negative cases include compressed driver residue and a large initramfs listing
    with pipefail enabled.
  • Replacement VHD run 183958924:
    both Ubuntu target jobs passed, including content validation, on merge
    a993a34. The four target test/scan resource groups are independently
    confirmed deleted; the produced images are retained for GPU verification.
  • Important scan limitation: both CIS assessments reported license-limited
    assessment exit 122/tool exit 1 despite the successful wrapper jobs. This is
    not evidence of completed CIS compliance scans.
  • Exact-image GPU run 183965109
    finished 2 passed / 187 skipped / 5 failed against these images and
    fix: install absent or incomplete managed Ubuntu GPU drivers #9692's consumer source. Both westus3 GRID cases passed first attempt with
    driver 570.237. Five T4 cases failed before VM creation because Shallow
    images cannot replicate to westus2; the helper retried the permanent Azure
    error for 3000 seconds. Both created VMSS identities are confirmed absent.
    This is not CUDA, opt-out or validation-only coverage.
  • Bash ShellCheck using repository exclusions and Bash syntax checks passed.
  • CI subsequently reported SC2119/SC2120 for the two helpers' optional fixture
    roots, although local ShellCheck did not reproduce those warnings. Commit
    387b780 passes "" at both production call sites instead of relying on
    the identical empty default. All 75 examples still pass; no root-path or
    image-policy behavior changes. The images above came from preceding
    5c77850. Current-head VHD gate 183969331,
    merge 5f9c38e, has passed all 12 image build/content jobs, including both
    intended Ubuntu images. Downstream general E2E finished 116 passed /
    74 skipped / 2 failed
    : the known AzureLinuxV3Gen2Kata migration warning,
    plus LocalDNSHostsPlugin/Ubuntu2204's fault-injection check missing the
    expected start-limit journal entry (Result=exit-code, NRestarts=5).
    The latter's cause is not established; the PR does not change LocalDNS
    source, but that alone does not prove it unrelated. The overall gate is red.
    All 121 logged downstream VMSS identities and the four target test/scan
    groups are independently absent. Both current target CIS
    assessments remain license-limited (122/tool exit 1), not completed scans.
    Replacement CI ShellCheck 37080778665 and ShellSpec 37080778755 both passed.
  • Replacement exact-image GPU run 183976638
    succeeded: 6 passed, 1 flaky, 187 skipped, 0 failed on isolated test-only
    source 8bc42be, pairing fix: install absent or incomplete managed Ubuntu GPU drivers #9692 with current 183969331 images
    2204gen2containerd/1.1790986591.27907 and
    2404gen2containerd/1.1790986591.7556. All seven required cases eventually
    passed with unchanged GPU SKUs and validators. Only test-branch T4 placement
    changes to westus3; current CSE, no capacity skips and one retry remain pinned.
    Neither product PR changes placement; no image copies or shared-image
    updates were needed.
  • Both Ubuntu validation-only cases passed first attempt, with actual traces
    proving the missing nvidia-modprobe dispatch into normal installation and
    subsequent healthy SMI 580.159.04/CUDA 13.0. Both opt-out cases, 22.04 GRID,
    and 24.04 GRID/device-plugin also passed first attempt.
  • The normal 22.04 CUDA case timed out in first-attempt VMSS provisioning
    (17m38s), then passed unchanged on attempt 2 (9m22s). Serial-only evidence
    shows NVIDIA module loading, but the precise timeout cause is unresolved;
    it is not dismissed as platform-only. All eight explicitly created
    GPU-attempt VMSS are independently absent. This targeted success does not
    make broad CI green or establish distinct-VM PIS/kernel-update acceptance.
  • Changed pipeline YAML parsed with Ruby Psych.
  • ShellCheck 0.11's additional POSIX-only pass reports ten existing SC3014
    warnings across the changed builder/content scripts; base comparison confirms
    no introduced diagnostics.
  • Changed-VHD checks and GPU tests are part of verification; local fixture
    results do not establish real-image boot, PIS or latency behavior.

Rollout and remaining operational work:

Release the companion missing-driver consumer change #9692 before broad rollout where
validation-only callers otherwise spend 115 seconds retrying an absent binary.
Verify changed Ubuntu images on CPU/opt-out, CUDA and GRID nodes, distinct-VM PIS,
and kernel-update paths, using explicit source/VHD identities.

Changing future image production does not repair existing security-patched
derivatives, PIS caches or deployed nodes. Refresh affected image lineages and
nodes through the supported lifecycle; retain legacy cleanup. Re-enabling active
shared-image prebaking is not a safety-preserving rollback.

Which issue(s) this PR fixes:

Follow-up to merged #9694. This PR does not close or modify the host-prebake
parking/no-DKMS drafts #9545, #9551 or #9568.

Disable shared-image host prebaking, retain installer prerequisites and fail final-image validation on NVIDIA registration or installed host residue.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 61d3dd43-5cc2-49b3-9ce5-fbe943764363

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Updates Ubuntu shared VHD GPU handling to cache the CUDA-LTS installer container without prebaking/installing the NVIDIA driver, and adds stricter validation to prevent publishing “contaminated” images.

Changes:

  • Switch shared Ubuntu 22.04/24.04 amd64 Gen2 pipeline defaults to FEATURE_FLAGS=None (cache-only).
  • Add build-time prerequisites + nouveau blacklist/initramfs refresh for cache-only images.
  • Add content-test invariant checks (no DKMS registration/modules/artifacts; required prerequisites and installer cache present) plus new ShellSpec fixtures.
File Description
vhdbuilder/​packer/​test/​linux-vhd-content-test.sh Adds a new final-image invariant test to enforce “GPU cache-only” policy on shared Ubuntu images.
vhdbuilder/​packer/​install-dependencies.sh Adds cache-only prerequisites setup (toolchain + nouveau blacklist + initramfs refresh) during image build.
parts/​linux/​cloud-init/​artifacts/​ubuntu/​cse_install_ubuntu.sh Introduces shared predicate isUbuntuGPUCacheOnlyImage() used by both build and validation logic.
spec/​vhdbuilder/​packer/​gpu_cache_only_spec.sh Adds fixtures covering the new predicate, build prerequisite behavior, and invariant enforcement.
.pipelines/​.vsts-vhd-builder.yaml Changes shared-image jobs to set FEATURE_FLAGS=None (no prebake).
.pipelines/​.vsts-vhd-builder-release.yaml Same as above for release pipeline jobs.
vhdbuilder/​packer/​README.md Documents the new shared Ubuntu GPU installer cache-only policy and validation expectations.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vhdbuilder/packer/test/linux-vhd-content-test.sh
Comment thread vhdbuilder/packer/install-dependencies.sh
Comment thread vhdbuilder/packer/test/linux-vhd-content-test.sh
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   18 suites   1m 11s ⏱️
551 tests 551 ✅ 0 💤 0 ❌
554 runs  554 ✅ 0 💤 0 ❌

Results for commit 387b780.

♻️ This comment has been updated with latest results.

Exclude only the kernel platform backlight path from cache-only disk and initramfs checks. Keep rejecting DKMS-path copies and test compressed modules plus pipefail behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 61d3dd43-5cc2-49b3-9ce5-fbe943764363
Copilot AI balanced review requested due to automatic review settings October 2, 2026 23:01
Preserve merged PR 9694 pipeline defaults exactly; retain only cache-only prerequisites and image invariants as follow-up changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 61d3dd43-5cc2-49b3-9ce5-fbe943764363
@ganeshkumarashok Ganeshkumar Ashokavardhanan (ganeshkumarashok) changed the title fix(gpu): keep shared Ubuntu VHDs cache-only fix: validate cache-only Ubuntu GPU images and preserve prerequisites Oct 2, 2026

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.

err "$test" "Cannot resolve cached GPU installer reference"
return 1
fi
if ! cached=$(ctr -n k8s.io images ls -q "name==$image") || [ "$cached" != "$image" ]; then
local root="${1:-}"

# Keep the ordinary node-time installer independent of the optional host prebake.
apt_get_install 10 2 300 gcc make libc6-dev || return 1
apt_get_install 10 2 300 gcc make libc6-dev || return 1
mkdir -p "${root}/etc/modprobe.d" || return 1
printf 'blacklist nouveau\noptions nouveau modeset=0\n' > "${root}/etc/modprobe.d/blacklist-nouveau.conf" || return 1
update-initramfs -u -k all || return 1
fi
# Include dangling links and residue with a missing marker; do not silently sanitize the image.
for path in "${root}"/var/lib/dkms/nvidia* "${root}"/usr/src/nvidia* \
"${root}"/usr/bin/nvidia* "${root}"/usr/sbin/nvidia* "${root}"/usr/bin/lib64 \

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.

fi
done
if ! image=$(jq -er '
[.GPUContainerImages[] | select(.downloadURL == "mcr.microsoft.com/aks/aks-gpu-cuda-lts:*") | .gpuVersion.latestVersion]
Comment on lines +845 to +850
local root="${1:-}"

# Keep the ordinary node-time installer independent of the optional host prebake.
apt_get_install 10 2 300 gcc make libc6-dev || return 1
mkdir -p "${root}/etc/modprobe.d" || return 1
printf 'blacklist nouveau\noptions nouveau modeset=0\n' > "${root}/etc/modprobe.d/blacklist-nouveau.conf" || return 1
fi
# Include dangling links and residue with a missing marker; do not silently sanitize the image.
for path in "${root}"/var/lib/dkms/nvidia* "${root}"/usr/src/nvidia* \
"${root}"/usr/bin/nvidia* "${root}"/usr/sbin/nvidia* "${root}"/usr/bin/lib64 \
@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: 183950052
Failed job/stage/task: build / build2404gen2containerd / Test, Scan, and Cleanup

Detective summary: Test/Scan retried the Ubuntu 24.04 GPU cache-only content validation twice and both attempts failed testUbuntuGPUCacheOnlyImage because host NVIDIA module nvidia-wmi-ec-backlight.ko.zst was unexpectedly present.

Likely cause / signature: vhd-ubuntu2404-gpu-cache-host-nvidia-module - GPU cache-only VHD content validation now sees an extra host NVIDIA kernel module; PR 9693 changes GPU cache-only spec/test surfaces, making a validator/spec expectation mismatch likely.

Confidence: Medium for PR-change-caused test/spec expectation drift; the failure is deterministic within the run.

Recommended owner/action: PR owner should confirm whether nvidia-wmi-ec-backlight.ko.zst is expected on the source kernel and update the GPU cache-only test allowlist/spec if appropriate.

Strongest alternative: A host image or kernel package drift could introduce the module independently of this PR, but the changed files include GPU cache-only spec and content-test logic.

Evidence: build run, failed task log/timeline, build metadata, PR changed files, and wiki tracker.

Wiki: vhd-ubuntu2404-gpu-cache-host-nvidia-module

Pass an explicit empty filesystem prefix at the two production call sites. Preserve the existing default-root behavior while satisfying CI ShellCheck SC2119/SC2120 for helpers with optional fixture roots.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 61d3dd43-5cc2-49b3-9ce5-fbe943764363
Copilot AI balanced review requested due to automatic review settings October 3, 2026 00:08
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
github.com/Azure/agentbaker/aks-node-controller 72% ➖
github.com/Azure/agentbaker/aks-node-controller/common 100% ✔
github.com/Azure/agentbaker/aks-node-controller/helpers 71% ➖
github.com/Azure/agentbaker/aks-node-controller/parser 89% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/gpu 100% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/nodeconfigutils 67% ➖
github.com/Azure/agentbaker/aks-node-controller/utils 0% ❌
github.com/Azure/agentbaker/apiserver 25% ❌
github.com/Azure/agentbaker/cmd 0% ❌
github.com/Azure/agentbaker/cmd/starter 0% ❌
github.com/Azure/agentbaker/fuzz/api 0% ❌
github.com/Azure/agentbaker/hotfix/render-nodecustomdata 0% ❌
github.com/Azure/agentbaker/pkg/agent 76% ➖
github.com/Azure/agentbaker/pkg/agent/datamodel 76% ➖
github.com/Azure/agentbaker/pkg/agent/toggles 0% ❌
github.com/Azure/agentbaker/pkg/vhdbuilder/datamodel 88% ✔
Summary 74% (6317 / 8582) ➖

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
test 0% ❌
windows 27% ❌
staging_cse_windows Package 1 65% ➖
debug 0% ❌
provisioningscripts 2% ❌
parts_windows Package 1 76% ➖
Summary 39% (1663 / 6838) ❌

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 22% ❌
Summary 22% (3164 / 14405) ❌

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@aks-node-assistant

Copy link
Copy Markdown
Contributor

AgentBaker Linux gate detective

Run: 183969331
Failed job/stage/task: e2e / Run AgentBaker E2E / Run AgentBaker E2E

Detective summary: E2E completed 192 scenarios with 116 passed, 0 flaky, 74 skipped, and 2 failed; AzureLinuxV3Gen2Kata failed on the recurring containerd migration-warning validator, and LocalDNSHostsPlugin/Ubuntu2204 also failed restart-budget validation.

Likely cause / signature: e2e-azurelinuxv3gen2kata-containerd-v2-migration-warning plus e2e-localdns-restart-budget-hungstart-not-bounded; both already have repair items.

Confidence: High for recurring known flakes over a new PR-specific break.

Recommended owner/action: Node/AgentBaker owners should continue repairs #39969892 and #39909321; PR owner only needs to act if touching Kata/containerd or LocalDNS restart-budget behavior.

Strongest alternative: PR 9693 changes GPU/VHD content-test areas, but the fatal signatures are recurring Kata/containerd and LocalDNS lifecycle validations across unrelated PRs.

Evidence: build run, failed timeline records, focused Run AgentBaker E2E log, build metadata, PR changed files, and wiki tracker.

Wiki: e2e-azurelinuxv3gen2kata-containerd-v2-migration-warning, e2e-localdns-restart-budget-hungstart-not-bounded

This branch has not been deployed

No deployments
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