news.volyx.in

Why are we templating YAML? (2019) (leebriggs.co.uk)

433 points by spiros · 940 days ago · 654 comments on HN

Article summary

The article discusses the problem of templating YAML for configuration management, particularly in Kubernetes, and argues that it's not the best approach. The author suggests using Jsonnet, a data templating language, to generate JSON config instead. The article highlights the difficulties of templating YAML, such as dealing with whitespace and optional fields, and shows how Jsonnet can simplify the process. The author also mentions their own project, kr8, which uses Jsonnet to manage Kubernetes configuration.

Main themes

  • YAML templating
  • Jsonnet
  • Kubernetes configuration management
  • programming languages for config generation
  • configuration complexity
  • DSLs vs general-purpose languages
  • templating engines and tools
  • configuration file maintainability

What commenters say

  • Templating YAML is cumbersome and error-prone, and should be avoided in favor of more robust solutions like Jsonnet.
  • Using a programming language like TypeScript or JavaScript to generate configuration is a viable alternative to templating YAML.
  • The complexity of YAML templating can lead to it becoming a de facto programming language, which is not its intended purpose.
  • Some commenters prefer using existing programming languages, like Python, to generate configuration, rather than relying on templating engines or custom DSLs.
  • Others argue that YAML templating is not inherently bad, but rather a necessary evil due to its widespread adoption and ease of use.
  • The use of YAML templating can lead to configuration files becoming overly complex and difficult to maintain.
  • Some commenters suggest that using a more expressive configuration language, like Dhall or Jsonnet, can help mitigate these issues.