Skip to content

feat: use MIG profile layout for partitioning - #9129

Open
Karen Chen (karenychen) wants to merge 7 commits into
mainfrom
codex/mig-profile-layout-runtime
Open

feat: use MIG profile layout for partitioning#9129
Karen Chen (karenychen) wants to merge 7 commits into
mainfrom
codex/mig-profile-layout-runtime

Conversation

@karenychen

Copy link
Copy Markdown
Contributor

What this PR does

Completes the runtime half of the MIG profile layout contract introduced by #9081.

  • treats either MIGProfileLayout or legacy GPUInstanceProfile as a MIG node in classic CSE and aks-node-controller
  • makes a non-empty MIGProfileLayout authoritative when both fields are populated
  • maps the ordered layout directly to NVIDIA profile IDs without sorting, capacity expansion, or MigStrategy interpretation
  • retains legacy uniform expansion when only GPUInstanceProfile is populated
  • propagates failures from both nvidia-smi mig -cgi and nvidia-smi mig -cci
  • keeps MigStrategy solely for nvidia-device-plugin advertisement behavior
  • adds focused ShellSpec coverage plus Single, Mixed, and legacy GPU e2e coverage

This supersedes the runtime/test portion of closed #8869. AKS RP layout calculation remains out of scope.

Validation

  • make generate regenerated Go test data and the manifest without changes; its repository-wide ShellCheck tail stops on the existing POSIX SC3014 baseline
  • go test ./pkg/agent/... -count=1
  • go test ./parser/... -count=1 from aks-node-controller
  • go test . -run '^$' -count=1 from e2e
  • focused ShellCheck for mig-partition.sh and its ShellSpec
  • focused ShellSpec: 15 examples, 0 failures
  • Buf lint
  • Buf breaking check against Azure/AgentBaker main
  • git diff --check

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 5, 2026, 5:50 PM

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   12 suites   50s ⏱️
389 tests 389 ✅ 0 💤 0 ❌
392 runs  392 ✅ 0 💤 0 ❌

Results for commit 1bf4cd9.

♻️ This comment has been updated with latest results.

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 completes the runtime support for the ordered MIGProfileLayout contract (introduced in #9081) across classic CSE and aks-node-controller, enabling MIG partitioning based on an explicit ordered layout while preserving legacy GPUInstanceProfile uniform expansion behavior.

Changes:

  • Treats nodes as MIG-enabled when either MIGProfileLayout or legacy GPUInstanceProfile is populated, with MIGProfileLayout taking precedence when non-empty.
  • Updates mig-partition.sh to map the ordered layout directly to NVIDIA profile IDs (preserving order/duplicates) and to propagate failures from nvidia-smi mig -cgi and nvidia-smi mig -cci.
  • Adds/updates focused ShellSpec coverage and GPU e2e coverage for legacy, Single, and Mixed MIG scenarios, plus additional validators for exact advertised resources and MIG strategy.

Reviewed changes

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

Show a summary per file
File Description
spec/parts/linux/cloud-init/artifacts/mig_partition_spec.sh Adds ShellSpec coverage for legacy and layout-driven MIG partitioning behavior and failure propagation.
pkg/agent/variables.go Sets MIG_NODE based on either legacy scalar or layout being populated.
pkg/agent/datamodel/helper.go Extends IsMIGNode to consider both legacy and layout inputs.
pkg/agent/baker.go Uses the shared IsMIGNode logic when templating MIG enablement.
pkg/agent/baker_test.go Updates tests to assert MIG env vars for legacy and layout-driven cases.
parts/linux/cloud-init/artifacts/mig-partition.sh Implements authoritative ordered layout parsing and legacy uniform expansion; propagates nvidia-smi failures.
e2e/validators.go Adds validators for MIG strategy, exact GPU resource advertisement, and exact MIG instance profile counts.
e2e/scenario_gpu_managed_experience_test.go Adds/updates Ubuntu 24.04 MIG scenarios for legacy field, layout+Single, and layout+Mixed with stricter validation.
e2e/node_config.go Propagates MIG-related fields (instance profile, strategy, layout) into AKS node config v1 for e2e.
aks-node-controller/proto/aksnodeconfig/v1/gpu_config.proto Clarifies MIG strategy semantics when MIG is enabled via either legacy scalar or layout.
aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go Regenerates Go bindings reflecting the updated proto comment/metadata.
aks-node-controller/parser/parser.go Sets MIG_NODE based on either legacy scalar or layout being populated.
aks-node-controller/parser/parser_test.go Updates parser tests to assert MIG env vars and MIG enablement for layout-only inputs.
aks-node-controller/parser/helper.go Extends MIG enablement helper to consider both legacy and layout inputs.
Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file

Comment thread parts/linux/cloud-init/artifacts/mig-partition.sh
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2026 18:09

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

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file
Suppressed comments (2)

pkg/agent/datamodel/helper.go:131

  • IsMIGNode treats any non-empty migProfileLayout slice as enabling MIG, but the layout is serialized via strings.Join. A slice like []string{""} makes MIG_NODE true while NVIDIA_MIG_PROFILE_LAYOUT becomes an empty string, causing mig-partition.sh to treat the layout as unset and fail with the misleading "neither ... is set" path. Consider only returning true when the layout contains at least one non-empty element (or trim-space non-empty) so MIG_NODE aligns with the serialized env var.
// IsMIGNode check if the node should be partitioned.
func IsMIGNode(gpuInstanceProfile string, migProfileLayout []string) bool {
	return gpuInstanceProfile != "" || len(migProfileLayout) > 0
}

aks-node-controller/parser/helper.go:255

  • getIsMIGNode uses len(migProfileLayout)>0, which can make MIG_NODE true even when the serialized NVIDIA_MIG_PROFILE_LAYOUT ends up empty (e.g., []string{""}). That leads to inconsistent behavior (MIG_NODE true, but mig-partition.sh sees no layout). Consider requiring at least one non-empty profile entry before enabling MIG based on migProfileLayout.
func getIsMIGNode(gpuInstanceProfile string, migProfileLayout []string) bool {
	return gpuInstanceProfile != "" || len(migProfileLayout) > 0
}

Copilot AI review requested due to automatic review settings August 4, 2026 18:15
@karenychen

Copy link
Copy Markdown
Contributor Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file

Comment thread aks-node-controller/parser/parser.go Outdated
Comment thread aks-node-controller/parser/parser_test.go
Comment thread aks-node-controller/parser/parser_test.go
Comment thread e2e/validators.go
Comment thread spec/parts/linux/cloud-init/artifacts/mig_partition_spec.sh Outdated
Copilot AI review requested due to automatic review settings August 4, 2026 20:24

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

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

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file

Comment thread parts/linux/cloud-init/artifacts/mig-partition.sh
Copilot AI review requested due to automatic review settings August 4, 2026 20:37

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

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

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file

Comment on lines 128 to 131
// IsMIGNode check if the node should be partitioned.
func IsMIGNode(gpuInstanceProfile string) bool {
return gpuInstanceProfile != ""
func IsMIGNode(gpuInstanceProfile string, migProfileLayout []string) bool {
return gpuInstanceProfile != "" || len(migProfileLayout) > 0
}
@aks-node-assistant

Copy link
Copy Markdown
Contributor

🔍 AgentBaker Linux Gate Detective

Build: 175174418 | PR: #9129 | Failed job/stage: �uild → �uild2604minimalgen2containerd → Build VHD (task �188ffa6 / �d2d3f37, 4 attempts)


TL;DR

Ubuntu 26.04 minimal VHD build fails consistently because linux-modules-extra-azure-lts-26.04 is not available in the Ubuntu apt repository. The provisioning script purges the existing kernel then attempts to install the LTS metapackage, which does not exist. All 4 Packer retries fail identically. This is not caused by changes in this PR.


Failure Details

Field Value
Stage/Job �uild / �uild2604minimalgen2containerd
First failing step �pt-get install linux-modules-extra-azure-lts-26.04 (Packer provisioner shell script, script exit 100)
Primary error E: Unable to locate package linux-modules-extra-azure-lts-26.04
Make error make[1]: *** [packer.mk:36: build-packer] Error 1 → make: *** [packer.mk:96: run-packer] Error 2
Retry pattern 4 attempts (1 + 3 retries), all identical failure
Disk/space Normal (1.2G/28G used), not a space issue

Three-Level RCA

Level 1 — Surface failure: Packer provisioner exits 100 (non-zero) during kernel replacement step. The script successfully purges existing linux-image-7.0.0-1011-azure / linux-modules-7.0.0-1011-azure, then fails on install of LTS metapackage.

Level 2 — Corroboration (≥2 independent sources):

  1. Three independent PRs (feat(anc): use gRPC as the check-hotfix live-patching transport #9050, ci: add GPU E2E opt-out #9131, feat: use MIG profile layout for partitioning #9129) all fail identically → not change-caused
  2. Task retried 4 times with the same E: Unable to locate package → deterministic, not transient
  3. Disk diagnostics in cleanup provisioner show healthy filesystem → not infrastructure disk issue
  4. Previous �uild2604minimalgen2containerd failures (build 174977497) had a different root cause (inspektor-gadget), confirming this is a distinct new issue

Level 3 — Root-cause challenge:

Theory Assessment
Upstream package unavailable ✅ (strongest) linux-modules-extra-azure-lts-26.04 does not exist in Ubuntu 26.04 apt repos. Ubuntu 26.04 LTS is newly released (Apr 2026); LTS kernel metapackages (-lts-XX.04) are published on a delayed schedule by Canonical. Package may not exist yet, or the naming convention differs for 26.04.
Code-change-caused ❌ (very unlikely) Three unrelated PRs (gRPC transport, CI GPU label, MIG profile layout) all trigger same failure → not this PR.
Build infra/image ❌ (unlikely) Base image VM shows kernel 7.0.0-1011-azure present; purge succeeds; only the LTS metapackage is missing.

Verdict

Field Value
Signature ID $sigId\
Classification VHD/Packer/provisioning — upstream package unavailable
Likely root cause linux-modules-extra-azure-lts-26.04 not published in Ubuntu 26.04 apt archive
Confidence High (95%)
Strongest alternative Package naming changed for 26.04 (different from 22.04 pattern) — less likely since linux-image-azure-lts-26.04 also not found
Recommended owner Node Lifecycle / VHD infra team
Recommended action 1. Check if linux-modules-extra-azure-lts-26.04 exists in Canonical Ubuntu archive; 2. If not yet published, consider pinning to versioned packages (linux-modules-extra-7.x.x-xxxx-azure) as interim fix; 3. Track Canonical LTS kernel publication for 26.04

Evidence Links

Copilot AI review requested due to automatic review settings August 5, 2026 17:50

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

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • aks-node-controller/pkg/gen/aksnodeconfig/v1/gpu_config.pb.go: Generated file
Suppressed comments (1)

parts/linux/cloud-init/artifacts/mig-partition.sh:82

  • if $is_last_profile; then executes the variable as a command (relying on true/false being available in PATH). Using a string comparison avoids accidental command execution if this variable is ever refactored or assigned unexpectedly.
        if $is_last_profile; then

Copilot AI review requested due to automatic review settings August 6, 2026 20:55

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

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