cdk8s-team / cdk8s-core

Define Kubernetes native apps and abstractions using object-oriented programming
Apache License 2.0
64 stars 26 forks source link

Add new YamlOutputType to generate a tree of charts #2672

Open baptman21 opened 1 month ago

baptman21 commented 1 month ago

Description of the feature or enhancement:

Add a new YamlOutputType to generate the charts in a tree of folders for subcharts:

output-dir
| chart-a/
|   | subchart-a1/
|   | subchart-a2/
| chart-b/
|   | subchart-b1/
|   | subchart-b2/

Instead of the current

output-dir/
| XXXX-chart-a
| XXXX-chart-b
| XXXX-subchart-a1
| XXXX-subchart-a2
| XXXX-subchart-b1
| XXXX-subchart-b2

Use Case:

Currently, the only types of generations in yaml are:

The problem I have been experiencing is that when you have a big infrastructure with a lot of subcharts, the output is more difficult to read and review, since you have many folders in the same output folder.

Proposed Solution:

Had a case in app.ts to generate the folders using the dependency graph.

Other:

I think they are alternatives to this feature. For example, I suppose that you can use multiple Apps in your code, using an App of Apps patterns if you want to split the output. Did anyone ever use this pattern ? My main question on this is, would it work well to use multiple Apps in the same bit of code, and call synth() on all of them.


This is a :rocket: Feature Request

shinebayar-g commented 1 month ago

I'm currently renaming output directories in my cdk8s app.ts after app.synth() is called. If I move directories outside of the cdk8s --output dir parameter, cdk8s says No manifests synthesized. But if I move directories only inside that parameter, cdk8s correctly recognizes the moved directories. I'm relying on this behavior for the moment until cdk8s supports more flexible output dir mechanism.

I suppose that you can use multiple Apps in your code

I think I tried that, don't remember if it worked successfully.