refactor: add GenerateManifest to decouple generating kustomizations from writing#1153
Conversation
3815efd to
6a89ab1
Compare
8bc7bfb to
94b031e
Compare
5dc2b1c to
d3d47ff
Compare
|
Codex found the following:
|
|
Thanks for taking a look @matheuscscp ! If I understand the comment correctly, this is not a bug (per se); mainly comes down to what behavior we'd want to enable. I have to admit that the stated failure case doesn't make a ton of sense to me, in context. The intention isn't to offer a "free-form" virtual filesystem for general use (that's already provided by kustomize.MakeFsInMemory); it's specifically to isolate writes of [missing] Kustomization manifests, in cases where writing to the actual filesystem isn't desirable. In that case, the behavior of "underlying filesystem reads are always available" is desirable; we should only ever be writing where there is no file. If we end up overwriting existing paths, something is going wrong elsewhere (i.e., how did you end up with the "foo" file in memory, when there was already a same-name directory there?). I can whip up some additional "edge case" checks and/or tests at the virtual FS layer, but I wonder if that isn't just additional noise at this moment 🤔 |
|
Yep, agreed! |
5700ab4 to
e0f6ecc
Compare
|
@rycli did you run the tests locally? |
|
Also please squash all those fixes into the parent commit |
My last changes were passing locally, but I didn't manually test after the rebase (done via GitHub). I'll take a look at what's going wrong tonight; sorry about that! |
|
The error from CI is: |
Signed-off-by: Cyril Mengin <cyril@ryc.li>
e0f6ecc to
4bb52f7
Compare
|
@stefanprodan fixed! 515925b added a reference to the old argument signature, and therefore weren't included in my update. Tests are now passing for me locally :-) I've also squashed the commits as requested. |
One half of changes necessary to resolve fluxcd/flux2#5781 ; foundation needed for the changes introduced by fluxcd/flux2#5794
These changes to
kustomize_generatordecouple the file reading/generating logic from the writing and cleanup steps.The
WriteFilefunction keeps the same behavior, so no change to existing callers; but it now wrapsGenerateManifestinternally which extracts the logic for generating kustomizations. This allows calling the generating logic directly without writing the files :-)