4 ms·
https://jsonnet.org/ https://jsonnet.org/ https://cuelang.org/ https://cuelang.org/
by thinkmassive 3y ago
https://jsonnet.org/ https://jsonnet.org/
https://cuelang.org/ https://cuelang.org/
- lijok 3y agoThese are interesting. I've seen both before but never understood - if I have a config that cannot be easily written out in yml, why would I force my team to learn either one of these DSLs instead of using our main dev language (say python) to generate the yml instead? What's the value proposition of jsonnet or cue?
- SOLAR_FIELDS 3y agoOne very important thing to point out here is that you’re not just writing config with this YML. If you look at the example on the GitHub link it’s a workflow orchestration and execution context. There’s a code runtime involved and logic is executed in the YAML. That is where YAML falls apart. If all you’re doing is defining configurations (example is Kubernetes manifests helm charts etc) then great. But that isn’t what this is. To your original question, I would actually advocate using the general purpose programming language for most use cases. Learning a new DSL, like you mentioned, is overhead from both a usability and maintainability perspective. I haven’t used jsonnet before but I know that cuelang gives you some power tools around typing, config validation, templating etc. it’s essentially purpose made for configuration management and tooling so it’s probably going to be really good at that. I don’t know if it’s worth using over a suite of language specific tools like Pydantic + Jinja though because when you’re using a general purpose language like python you have a whole, much larger ecosystem of tools and libraries you also have access to and can pull from.
- thinkmassive 3y agoI agree with this for internal tools only intended to be used by a relatively small organization. Using a DSL may well be preferable for open source, and for larger organizations where not every team is proficient in your Turing-complete language of choice. Some drawbacks of plain YAML, and of tools that use string templating to render YAML: - difficult to extend features not exposed by upstream - composition is often messy, resulting in duplication - validation is often impractical (at least identifying the exact source of the error… I’m looking at you Helm!) Unrelated to OP, but you can leverage Tanka to extend helm charts with functionality not provided by upstream. https://tanka.dev/ https://tanka.dev/