Repository navigation
fix: clean up remaining unstripped comments to reduce customdata size - #9892
Merged
Nishchay (awesomenix) merged 1 commit intoOct 24, 2026
Merged
Conversation
removeComments() only drops whole lines that start with "# " or "##", and trimTrailingComment() only cuts at the last "#" when it is followed by a space and the line does not start with echo. So "#EOF" markers, bare "#" lines and a few trailing comments still ship in Linux customData. In the scripts embedded in Linux customData: - remove 18 "#EOF" markers (and the blank line left before them) - remove 26 bare "#" lines inside comment blocks - move 8 trailing comments that were not stripped onto their own "# " line block_wireserver.sh gets the same 3 bare "#" removals so it stays identical to the kubelet.sh heredoc in cse_config_kubelet.sh (enforced by block_wireserver_spec.sh). Comment-only change. #HELPERSEOF, heredoc shebangs and #cloud-config are kept. Ubuntu 22.04/24.04 traditional customData (limit 87380): Go 1.26.10: 87488 -> 87260 Go 1.27.3: 86904 -> 86696 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c9945208-1180-4141-9674-2b89f5eceb22
Abigail Liang (abigailliang-aks-sig-node)
requested review from
a team
as code owners
October 23, 2026 21:26
Copilot started reviewing on behalf of
Abigail Liang (abigailliang-aks-sig-node)
October 23, 2026 21:26
Contributor
Windows Unit Test Results 3 files 18 suites 1m 10s ⏱️ Results for commit 480097a. |
Contributor
Contributor
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The comment-only changes preserve executable logic, required markers, and wireserver script parity, with no blocking issues identified.
No open issues 🎉
What changed in this PR
This follow-up to #9886 reduces Linux customData size by cleaning up comments that survive preprocessing, without changing executable logic. It provides short-term headroom while the broader encoding changes in #9880 remain separate.
Changes:
- Remove unused
#EOFmarkers, adjacent blank lines, and bare comment separators. - Move trailing comments onto standalone lines that preprocessing can strip.
- Keep the VHD wireserver script synchronized with its provisioning heredoc while preserving required markers.
| File | Description |
|---|---|
parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh |
Reformat architecture comment; remove separators and EOF marker. |
parts/linux/cloud-init/artifacts/ubuntu/cse_helpers_ubuntu.sh |
Remove EOF marker. |
parts/linux/cloud-init/artifacts/mariner/cse_install_mariner.sh |
Move trailing comment; remove separators and EOF marker. |
parts/linux/cloud-init/artifacts/mariner/cse_helpers_mariner.sh |
Remove EOF marker. |
parts/linux/cloud-init/artifacts/init-aks-cloud.sh |
Remove comment separator and EOF marker. |
parts/linux/cloud-init/artifacts/flatcar/cse_install_flatcar.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/flatcar/cse_helpers_flatcar.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/cse_main.sh |
Remove bare comment separators. |
parts/linux/cloud-init/artifacts/cse_install.sh |
Move parameter-expansion comments; remove EOF marker. |
parts/linux/cloud-init/artifacts/cse_helpers.sh |
Move regex source comment; remove separators. |
parts/linux/cloud-init/artifacts/cse_config.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/cse_config_network.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/cse_config_localdns.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/cse_config_kubelet.sh |
Remove heredoc comment separators and EOF marker. |
parts/linux/cloud-init/artifacts/cse_config_gpu.sh |
Remove comment separator and EOF marker. |
parts/linux/cloud-init/artifacts/cse_config_chrony.sh |
Remove a configuration comment separator. |
parts/linux/cloud-init/artifacts/cse_config_addons.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/block_wireserver.sh |
Match comment cleanup in the kubelet heredoc. |
parts/linux/cloud-init/artifacts/azlosguard/cse_install_osguard.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/azlosguard/cse_helpers_osguard.sh |
Remove EOF marker and adjacent blank line. |
parts/linux/cloud-init/artifacts/acl/cse_install_acl.sh |
Remove comment separators and EOF marker. |
parts/linux/cloud-init/artifacts/acl/cse_helpers_acl.sh |
Remove EOF marker and adjacent blank line. |
Review effort: Balanced
Contributor
Nishchay (awesomenix)
approved these changes
Oct 24, 2026
Nishchay (awesomenix)
deleted the
abigailliang/customdata-comment-cleanup
branch
October 24, 2026 03:23
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:
Follow-up to #9886. Linux traditional customData is very close to
MaxCustomDataLength(87,380). Before scripts are embedded,removeComments()inpkg/agent/utils.gostrips comments, but only in limited cases:#or##;trimTrailingComment()cuts at the last#on the line, only if that#is followed by a space, and never on lines that start withecho.This PR cleans up the remaining comment patterns that still end up in customData. It changes comments only, so there is no behavior change.
removeComments()#EOFend-of-file markers##lines inside comment blocks##amd64has no space;##or a#pullURL anchor inside the comment is the last#;echolines are skipped#line aboveblock_wireserver.shis the VHD copy and is not in customData. It gets the same 3 bare#removals so it stays identical to thekubelet.shheredoc incse_config_kubelet.sh, asblock_wireserver_spec.shrequires.These are intentionally kept:
#HELPERSEOF(cse_main.shwaits for it);#!/bin/bashshebangs;#cloud-config.The remaining
#EOFmarkers are in files that are not part of customData.Linux traditional customData size, main → this PR (limit 87,380):
gzip output differs between Go versions. CI uses Go 1.27, but
go.moddeclaresgo 1.26.0. Built with Go 1.26.x, Ubuntu customData on main is already over the limit:TestLivePatchingUsesVHDInsteadOfCustomDatafails at 87,488. With this PR it is 87,260.This saves only about 230 characters, so it is a stopgap. #9880 is still needed for real headroom.
Validation:
go test ./...(Go 1.27.3): pass.GOTOOLCHAIN=go1.26.10 go test ./pkg/agent -run TestLivePatchingUsesVHDInsteadOfCustomData: fails on main (87,488), passes with this PR (87,260).bash -non all changed scripts: pass.verify_shell.sh: no new findings compared with main.Which issue(s) this PR fixes:
N/A (follow-up to #9886)