Skip to content

feat: add WithInMemoryBuild to use virtual filesystem for building kustomizations#5794

Open
rycli wants to merge 5 commits intofluxcd:mainfrom
rycli:fix/in-memory-kustomize-build
Open

feat: add WithInMemoryBuild to use virtual filesystem for building kustomizations#5794
rycli wants to merge 5 commits intofluxcd:mainfrom
rycli:fix/in-memory-kustomize-build

Conversation

@rycli
Copy link
Copy Markdown

@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
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
go.mod Outdated
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
)

replace github.com/fluxcd/pkg/kustomize => github.com/rycli/fluxcd-pkg/kustomize v0.0.0-20260329153243-0671cee33351
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Temporary override to allow testing with the proposed changes to pkg/kustomize

@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
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 😄

rycli added 5 commits March 30, 2026 20:28
Signed-off-by: rycli <cyril@ryc.li>
Signed-off-by: rycli <cyril@ryc.li>
Signed-off-by: rycli <cyril@ryc.li>
@rycli rycli force-pushed the fix/in-memory-kustomize-build branch from fe0dbae to 5142a93 Compare March 30, 2026 18:28
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.

'flux build kustomization' corrupts files when run concurrently

2 participants