4 ms·
There's no reason to create an entirely new language. Since k8s manifests can be represented in JSON, you can use existing templating languages like Jsonnet [1]
by phailhaus 4y ago
There's no reason to create an entirely new language. Since k8s manifests can be represented in JSON, you can use existing templating languages like Jsonnet [1] in order to generate it for you. All we need is an official library.
[1] https://jsonnet.org/ https://jsonnet.org/
- vbezhenar 4y agoJSON is terrible to write by hand. YAML is terrible too. There should be an official and sane language which will map to YAML 1:1. We don't write Java code in YAML for a reason.
- jrockway 4y agoJsonnet is the language that maps to YAML 1:1. The output happens to look like JSON, but JSON is a subset of YAML. I've used Jsonnet for non-k8s stuff (envoy bootstrap configs), and it is really great. For example, this: https://github.com/pachyderm/pachyderm/blob/master/etc/generate-envoy-config/envoy.jsonnet https://github.com/pachyderm/pachyderm/blob/master/etc/gener... generates this: https://github.com/pachyderm/pachyderm/blob/master/etc/helm/pachyderm/envoy.json https://github.com/pachyderm/pachyderm/blob/master/etc/helm/...
- ninkendo 4y agoThere was a tool called ksonnet for this (jsonnet + a default library for k8s configs), but the company behind it got bought and it's no longer maintained: https://github.com/ksonnet/ksonnet https://github.com/ksonnet/ksonnet
- bboreham 4y agoA spiritual / practical successor is Tanka http://tanka.dev http://tanka.dev (Note I work for Grafana Labs who fund Tanka and use it for all production config)