Skip to content

fix: reduce legacy Linux customData payload size - #9597

Closed
Sylvain Boily (djsly) wants to merge 1 commit into
mainfrom
djsly-azurelinux-customdata-limit
Closed

Sylvain Boily (djsly) wants to merge 1 commit into
mainfrom
djsly-azurelinux-customdata-limit

Conversation

@djsly

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

The legacy cloud-init path gzip/Base64-encodes each script independently and then gzips the entire cloud-config. This prevents compression across scripts and leaves AzureLinuxV2 close to ARM's 87,380-character customData limit; small script changes can make VMSS creation fail before node validation.

Expand the template's gzip write_files contents before compressing the complete cloud-config. Preserve file bytes, permissions, owners, extra metadata, boot commands, and other cloud-config sections. Payloads without gzipped entries remain byte-identical. Embedded templates, scriptless NBC boothooks, Windows, and Ignition retain their existing formats; no scripts or LocalDNS coverage are removed.

Measured with the legacy regression fixtures:

Payload Before After ARM limit
Azure Linux 2/3 and Mariner 2 87,184 80,500 87,380
Ubuntu 22.04/24.04 90,196 83,764 87,380
Azure Linux 3 OS Guard 80,700 74,348 87,380

Add size/content-preservation tests across Linux distros, cloud-config metadata and binary/newline edge cases, invalid-input diagnostics, and a regression using the full legacy E2E bootstrap configuration. Update the pre-provisioning assertion to inspect write-file paths rather than searching inside now-readable script contents.

Which issue(s) this PR fixes:

AB#39729730 — AzureLinuxV2 customData OSProfile limit

Validation:

  • GENERATE_TEST_DATA=true go test ./pkg/agent/... — passed; no snapshot changes produced.
  • cd e2e && go test ./scenario -run 'CustomData|WriteFiles' -count=1 — passed.
  • cd e2e && go build ./... && go vet ./scenario — passed.
  • Repository-pinned golangci-lint on changed root/E2E code — passed.
  • Live VM provisioning/PR gate result is still pending. Compatibility relies on cloud-init's existing plain-content write_files and outer gzip support, not a new VHD capability.

🤖 Generated by GitHub Copilot

Expand gzip write_files contents before compressing the complete cloud-config so scripts share one compression stream. Preserve cloud-init metadata and leave scriptless NBC, Windows, and Ignition payloads unchanged.

AB#39729730

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 19, 2026 21:03
@github-actions

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% (6360 / 8625)

@github-actions

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   17 suites   1m 2s ⏱️
505 tests 505 ✅ 0 💤 0 ❌
508 runs  508 ✅ 0 💤 0 ❌

Results for commit 3040a06.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
staging_cse_windows Package 1 59%
debug 0%
provisioningscripts 2%
parts_windows Package 1 76%
test 0%
windows 21%
Summary 36% (1461 / 6716)

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 21%
Summary 21% (2903 / 13933)

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 review overview

🔵 Needs a closer look

It changes production Linux provisioning payload serialization across distributions, and live VM validation remains pending.

Review effort: Balanced
Findings: None

What changed in this PR

Reduces legacy Linux customData size by expanding per-file gzip content before compressing the complete cloud-config.

Changes:

  • Adds shared cloud-config expansion and compression logic.
  • Adds size, preservation, error, and legacy E2E regression tests.
  • Documents limits and validation commands.
File Description
README.md Documents customData limits and tests.
pkg/​agent/​baker.go Implements whole-cloud-config compression.
pkg/​agent/​customdata_test.go Tests size, fidelity, and errors.
pkg/​agent/​baker_test.go Updates pre-provisioning assertions.
e2e/​scenario/​customdata_test.go Tests representative legacy payloads.

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

@awesomenix

Copy link
Copy Markdown
Contributor

Addressed with this #9601

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.

3 participants