Skip to content

Add --in-memory-build to flux build ks and flux diff ks#5794

Merged
stefanprodan merged 2 commits intofluxcd:mainfrom
rycli:fix/in-memory-kustomize-build
Apr 10, 2026
Merged

Add --in-memory-build to flux build ks and flux diff ks#5794
stefanprodan merged 2 commits intofluxcd:mainfrom
rycli:fix/in-memory-kustomize-build

Conversation

@rycli
Copy link
Copy Markdown
Contributor

@rycli rycli commented Mar 29, 2026

One half of changes necessary to resolve #5781 ; makes use of changes introduced in the pkg dependency by fluxcd/pkg#1153

As suggested, this change keeps the current behavior for building kustomizations internally as part of flux build kustomization ..., but allows users to opt-in with the --in-memory-build flag, which will use filesys.MakeFsInMemory().

To keep things a bit cleaner, I opted to add a filesystem "backend" interface; defaults to "on disk", uses "in memory" if opted in. This keeps the rest of the codebase relatively untouched.

@rycli
Copy link
Copy Markdown
Contributor Author

rycli commented Mar 29, 2026

Small note: I see that the DCO workflow is failing... though I added the Signed-off-by line with "no alias" as requested. The workflow doesn't fail in this manner on the other PR; something in the configuration?

@stefanprodan
Copy link
Copy Markdown
Member

See https://github.com/fluxcd/flux2/pull/5794/checks?check_run_id=69071054594 right at the end it tells you the expected signature.

@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from 8b4379b to 2ea71a7 Compare March 29, 2026 14:56
@rycli rycli force-pushed the fix/in-memory-kustomize-build branch 2 times, most recently from 82f8f57 to cccf6d1 Compare March 29, 2026 18:04
@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from 643b7f7 to 8e290aa Compare March 29, 2026 19:30
@rycli
Copy link
Copy Markdown
Contributor Author

rycli commented Mar 30, 2026

@stefanprodan pushed the tests; I added an extra combination to the existing entries in TestBuild*. Seems to work 'transparently' as intended 😄

@stefanprodan
Copy link
Copy Markdown
Member

@rycli fluxcd/pkg/kustomize@v1.29.0 contains the in-memory FS. Please bump then rebase your PR.

@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from 5142a93 to 180edbf Compare April 10, 2026 18:12
@stefanprodan stefanprodan changed the title feat: add WithInMemoryBuild to use virtual filesystem for building kustomizations Add --in-memory-build to flux build ks and flux diff ks Apr 10, 2026
@stefanprodan stefanprodan added enhancement New feature or request area/kustomization Kustomization related issues and pull requests labels Apr 10, 2026
Signed-off-by: rycli <cyril@ryc.li>
@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from 180edbf to 1059d07 Compare April 10, 2026 18:24
@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from 1059d07 to e5128ea Compare April 10, 2026 19:45
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @rycli 🥇

@stefanprodan
Copy link
Copy Markdown
Member

@rycli if you have time, could you please look into finding a solution for #5439

@stefanprodan stefanprodan merged commit 7d7f20d into fluxcd:main Apr 10, 2026
6 checks passed
@rycli rycli deleted the fix/in-memory-kustomize-build branch April 10, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kustomization Kustomization related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'flux build kustomization' corrupts files when run concurrently

2 participants