Skip to content

feat: shrink flatcar customdata size#7755

Merged
awesomenix merged 3 commits intomainfrom
jepio/shrink-flatcar-customdata
Feb 3, 2026
Merged

feat: shrink flatcar customdata size#7755
awesomenix merged 3 commits intomainfrom
jepio/shrink-flatcar-customdata

Conversation

@jepio
Copy link
Member

@jepio jepio commented Jan 30, 2026

What this PR does / why we need it:
This PR changes the way customdata is handled for Flatcar nodepools, by packing up all file contents into a tarball, putting that into the customdata and unpacking at runtime. This allows the file contents to be compressed more efficiently than before. Flatcar's customdata handler (ignition) does not support gzipped customdata.

Which issue(s) this PR fixes:

Fixes #

Copy link
Contributor

Copilot AI left a comment

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 reduces Flatcar customData size by embedding generated file payloads into a single tarball that’s included in Ignition customData and extracted during early boot (since Ignition customData itself can’t be gzipped).

Changes:

  • Pack Flatcar write_files + bootcmd artifacts into a tarball, embed it in Ignition, and extract it at boot via a new systemd unit.
  • Remove the previous “Ignition envelope” wrapping approach for Flatcar customData generation.
  • Update Flatcar snapshot testdata and unit tests to validate the tarball-based approach.

Reviewed changes

Copilot reviewed 4 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/agent/baker.go Builds a tarball from cloud-init payloads, embeds it in Ignition, and stops using the prior envelope wrapping for Flatcar.
parts/linux/cloud-init/flatcar.yml Adds ignition-file-extract.service to extract the tar payload before ignition-bootcmds.service runs.
pkg/agent/utils.go Adds a gzip decode helper used by the new tarball pipeline and tests.
pkg/agent/baker_test.go Updates tests/helpers to decode and inspect the tarball payload, and adjusts Flatcar expectations (units/files).
pkg/agent/testdata/Flatcar/CustomData Refreshes Flatcar customData snapshot to match the new tarball + extract-unit format.

@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from 60ef954 to 3fc9450 Compare January 30, 2026 16:44
Copilot AI review requested due to automatic review settings January 30, 2026 16:46
@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from 3fc9450 to cd4daad Compare January 30, 2026 16:46
Copy link
Contributor

Copilot AI left a comment

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 4 out of 10 changed files in this pull request and generated 2 comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we set this up top as the default and then avoid the nested if/else?

Copy link
Member Author

@jepio jepio Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, reworked the nesting into a flat block

@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from cd4daad to 0a85016 Compare February 2, 2026 13:25
@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from 0a85016 to f5e0c6c Compare February 2, 2026 13:43
Copilot AI review requested due to automatic review settings February 2, 2026 13:43
Copy link
Contributor

Copilot AI left a comment

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 4 out of 10 changed files in this pull request and generated 4 comments.

@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from f5e0c6c to 7d8238b Compare February 2, 2026 14:44
Copilot AI review requested due to automatic review settings February 3, 2026 08:42
@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from 7d8238b to b8328fc Compare February 3, 2026 08:42
Copy link
Contributor

Copilot AI left a comment

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 4 out of 10 changed files in this pull request and generated no new comments.

jepio added 3 commits February 3, 2026 19:25
The tarball is extracted very early during boot. Doing it this way makes
compression equally effective as cloud-init's whole config compression and gets
rid of the size problems we were hitting with the previous approach for
flatcar. The previous approach was effectively:

  base64(gzip([]base64(gzip(files))))

while the new one is more like

  base64(gzip([]files)).

Cloud-init does:

  gzip([]base64(gzip)).
@jepio jepio force-pushed the jepio/shrink-flatcar-customdata branch from b8328fc to 13d6a34 Compare February 3, 2026 18:25
@awesomenix
Copy link
Contributor

@awesomenix awesomenix merged commit 068403d into main Feb 3, 2026
30 of 34 checks passed
@awesomenix awesomenix deleted the jepio/shrink-flatcar-customdata branch February 3, 2026 22:27
mxj220 pushed a commit that referenced this pull request Feb 5, 2026
aadhar-agarwal added a commit that referenced this pull request Feb 16, 2026
Cherry-pick 068403d with conflict resolution:
- flatcar.yml: kept Issue 9 symlink workaround AND new ignition-file-extract.service
- Added storage.links symlink for ignition-file-extract.service (Issue 9 compat)
- Testdata regenerated via make generate

CustomData reduced from 62,761 to 55,991 chars (~11% smaller).
aadhar-agarwal added a commit that referenced this pull request Feb 16, 2026
Cherry-pick 068403d with conflict resolution:
- flatcar.yml: kept Issue 9 symlink workaround AND new ignition-file-extract.service
- Added storage.links symlink for ignition-file-extract.service (Issue 9 compat)
- Testdata regenerated via make generate

CustomData reduced from 62,761 to 55,991 chars (~11% smaller).
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

Comments