Repository navigation
fix: reduce Linux custom data encoding overhead - #9930
Open
Ben Brady (benjamin-brady) wants to merge 1 commit into
Open
Ben Brady (benjamin-brady) wants to merge 1 commit into
Ben Brady (benjamin-brady) wants to merge 1 commit into
Conversation
Extract YAML-native quoting from #9880 without its runtime CRC gate.\nKeep legacy gzip template lookups compatible with new quoted entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ben Brady (benjamin-brady)
requested review from
a team,
Devinwong,
Nishchay (awesomenix),
Cameron Meissner (cameronmeissner),
Sylvain Boily (djsly),
lilypan26,
Artur Khantimirov (r2k1) and
Tim Wright (timmy-wright)
as code owners
October 28, 2026 08:07
Contributor
Windows Unit Test Results 3 files 18 suites 1m 19s ⏱️ Results for commit bad7249. |
Contributor
Contributor
|
Contributor
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The critical Linux bootstrap file-delivery change lacks live-node and older-VHD validation, requiring owner confirmation of provisioning and byte fidelity across supported cloud-init versions.
No open issues 🎉
What changed in this PR
Reduces AgentBaker’s traditional Linux CustomData size by removing per-file compression inside the already-compressed payload. This changes provisioning packaging, not VHD contents, and excludes the runtime checksum gate from #9880.
Changes:
- Uses YAML double-quoted file content, preserving delivered bytes and rejecting invalid UTF-8.
- Preserves legacy and mixed-template support while leaving Flatcar, ACL, and scriptless encoding unchanged.
- Updates hotfix parsing, delivery documentation, and regression coverage. Ubuntu custom-cloud size overflow remains tracked separately in #9790.
| File | Description |
|---|---|
pkg/agent/variables.go |
Selects plain or compressed content and supports both template maps. |
pkg/agent/utils.go |
Separates script rendering from compression. |
pkg/agent/utils_test.go |
Updates script discovery for the encoder abstraction. |
pkg/agent/mariner_live_patching_delivery_test.go |
Checks size using the generated Azure Linux payload. |
pkg/agent/live_patching_delivery_test.go |
Checks size using the generated Ubuntu payload. |
pkg/agent/cloud_init_encoding_test.go |
Adds byte-fidelity, compatibility, encoding, and size coverage. |
pkg/agent/baker.go |
Adds YAML quoting, UTF-8 validation, and legacy lookup fallback. |
pkg/agent/baker_test.go |
Checks delivered paths rather than script-content references. |
parts/linux/cloud-init/nodecustomdata.yml |
Uses mode-aware file-content and encoding helpers. |
parts/linux/cloud-init/artifacts/README.MD |
Documents encoding behavior and template compatibility. |
hotfix/hotfix_generate.py |
Recognizes both legacy and current template maps. |
hotfix/hotfix_generate_test.py |
Covers both maps and updates renderer expectations. |
Review effort: Balanced
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Extract the encoding change from #9880, leaving the runtime CRC/length verification gate out of this focused PR. Traditional Linux CustomData is already gzipped as a whole; independently gzipping and base64-encoding each embedded file reduces cross-file compression and pushes payloads toward Azure's 87,380-character limit.
Render traditional Linux file content as YAML-native double-quoted strings, preserving decoded file bytes, paths, permissions, ownership, and ordering. Reject invalid UTF-8 rather than replacing bytes. Keep Flatcar, ACL, and scriptless gzip file encoding unchanged. Preserve legacy and mixed template lookups, and teach the hotfix generator to recognize both template maps. Update the directly related delivery documentation.
This changes provisioning payload packaging, not VHD contents. It does not require new VHD capabilities. There is no checksum calculation, new guest command, or fail-closed CRC provisioning step in this PR. #9880 remains unchanged.
Local synthetic fixtures, measured using Go 1.26.2 on macOS/arm64:
Ubuntu custom-cloud overflow remains unresolved and is tracked separately in #9790. These measurements are synthetic fixture evidence, not a replay of the failing production request. No live-node or older-VHD provisioning validation was performed for this focused variant.
Validation:
GOTOOLCHAIN=local go test ./pkg/agent/... ./hotfix/render-nodecustomdata/... -count=1- passed with Go 1.26.2.PYTHONDONTWRITEBYTECODE=1 TMPDIR=/Users/benbrady/.copilot/session-state/b5e59165-7c46-4201-880a-fe127d58ad3e/files python3 -m unittest hotfix.hotfix_generate_test -v- passed, 30 tests.golangci-lint run ./pkg/agent/... ./hotfix/render-nodecustomdata/...- passed, zero issues; existing unknown-stylecheck-nolint warning remains.cd aks-node-controller && GOTOOLCHAIN=local go test ./...- passed.git diff --check- passed.git diff --exit-code origin/main -- parts/linux/cloud-init/artifacts/cse_cmd.sh spec/parts/linux/cloud-init/artifacts/cse_cmd_spec.sh- passed; no CRC runtime or shell-test changes.The legacy renderer regression was reproduced before the compatibility fix and passes afterward. Mixed old/new templates are checked for identical delivered bytes across ordinary, scriptless, ACL, and Flatcar configurations. Full CI is pending on this new PR.
Which issue(s) this PR fixes:
Related to #9880 and #9753. No issue is automatically closed.