timoni icon indicating copy to clipboard operation
timoni copied to clipboard

Provide a tool to convert helm charts

Open cosminilie opened this issue 2 years ago • 5 comments

Hey, really like the project and it seems like it’s the right path forward. My only concern is that to drive adoption there should be a way to covert a helm chart. The value of helm is in the effort put in developing and testing some of the most used charts. So a tool to import that work here is invaluable. It will be very hard to recreate a log to the work people put in those charts from scratch.

maybe a quick way to start would be to generate the yaml from helm via helm template and import it in cue and then simplify it.

cosminilie avatar Apr 08 '23 06:04 cosminilie

If you use Flux, you can already use Timoni along the side of Helm. I am not sure if it will be in scope for Timoni to e.g. render a Helm chart as part of a bundle.

Importing Helm charts does sound like a plausible idea. However, it's going to be very hard to transpile an arbitrary plain text template of a Helm chart into CUE.

Perhaps you could take a couple of examples sets of value, e.g. prod and dev examples, render the result, and try to automatically derive parametrise. You can go beyond that with some fuzzing. Employing GPT in the final stage might be an interesting option.

errordeveloper avatar Apr 18 '23 10:04 errordeveloper

One complexity here is that helm templates are not context sensitive.

I.e. in general a value inserted into a template could contain a newline and --- and output new documents, add fields to sections higher in the document tree, etc, roughly analogous to a sql injection. To be clear, helm templates are not a context where you expect malicious input, but it's still possible for chart authors and users to make mistakes. There are mitigations like the indent function, escaping etc, but like sql injections the best way is to use out of band parameters instead of trying to patch up a design that is flawed to begin with. This is one of the benefits of cue: by avoiding pure textual templates, input values can be processed with less concern for values inadvertently messing up the document structure.

Back on topic, this is one reason why it could be difficult to write a helm chart to cue/timoni converter: to ensure (bug-for-bug) compatibility, it may not be possible to do this automatically.

That said, what about a timoni to helm converter? This seems more likely since cue is easier to manipulate its ast via the cue.Value api. Also the above mentioned mitigations can be added automatically and consistently. This would allow authors to convert their helm chart to a timoni module manually, but still offer a helm chart to existing users and still offer the chart to the broad k8s community that is still using helm. Being able to export a timoni module as a helm chart could be a good strategy to promote adoption of timoni.

infogulch avatar Feb 05 '24 23:02 infogulch

Wondering about progress on this given Weaveworks shutting down

ybstaked avatar May 17 '24 21:05 ybstaked

Stefan is on vacation, but I can assure you this project is still something he spends time on as it was never a Weaveworks project.

hiddeco avatar May 17 '24 22:05 hiddeco