-
Notifications
You must be signed in to change notification settings - Fork 458
yaml2jsonnet utility #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
BTW for those who don't care about comments and order that's pretty trivial - it's enough to convert YAML to JSON and the JSON is also a valid Jsonnet program. |
I took a stab at sth like this last year, have a look at ycat |
Hey, this is a pretty cool tool! it seems to me more like "jq but using Jsonnet" than a conversion tool, though. The main point for this issue is to have a way of converting the YAML files while preserving the comments and the order, so that for example a Kubernetes user who wrote YAML by hand can trivially migrate (while preserving the comments and the reasonable order of fields). |
I was writing some Kubernetes resources for myself in Jsonnet and enjoying the experience -- I get a good understanding of what all the resources are and how they fit together. It's also nice because you can mostly just keep Then I grabbed some Helm charts and was frustrated that (1) I'd like to really learn what's going on in these complex charts also and (2) for my toy setup Helm's notion of immutable releases is really inconvenient. Anyway, I made https://github.com/waisbrot/yaml2jsonnet and was able to transform the nginx-ingress chart into a Jsonnet doc that worked in Kubernetes. It's pretty crude code right now, but if anyone has a use-case that they want me to try I'd be happy to give it a whirl. |
Nice! I haven't tried it yet, but based reading the code, it looks like it solves the problem here. @josdotso, @rustycl0ck, @mpeters FYI |
It would be nice to have a tool which allows converting existing YAML files to equivalent (trivial) Jsonnet. It doesn't need to support the whole YAML (a reasonable subset would still be useful), but it should preserve comments and ordering. This could be very useful when working with some existing YAML-based setup to gradually introduce Jsonnet.
I imagine that would be a completely separate binary. It may be a separate project or part of the standard Jsonnet distribution (both ways make sense for me).
The text was updated successfully, but these errors were encountered: