Avoid coding in YAML, Use a DSL
Configuration in YAML is fine, especially for non-full-time programmers.
But avoid coding in YAML (if conditions, looping, etc.). Use a DSL in a programming language instead.
Why? Because a DSL is not restricted (since it builds on top of a general-purpose language), and accomodates customization / complexity.
Plus, the DSL can generate the YAML, if the goal is to use YAML as the format of the input to the system.
- YAML as data format is defensible. YAML as a programming language is not.
- Kelsey Hightower on Kubernetes & YAML
- Every Sufficiently Advanced Configuration Language is Wrong
- Why DSLs Fail
- A lesson in creating and using niche business DSLs at scale | Zerodha Tech
- Why shouldn’t I just use python code for configuration?
- HN discussion : Don’t use a DSL where a full programming language is what you need
- HN discussion : infrastructure as code/yaml
- An alternative to explore is CUE lang (via).
- Hashicorp is providing general programming languages (TypeScript, Python) as an alternative to their custom config language (HCL) and JSON
- KubeFlow DSL compiler that generates YAML vs. Argo Workflows YAML examples
- How to build a DSL in Kotlin
- Gradle Kotlin DSL