werf / nelm

Nelm is a Helm 3 alternative and werf deployment engine
Apache License 2.0
264 stars 1 forks source link

Alternative to Go templates #54

Open ilya-lesikov opened 3 months ago

ilya-lesikov commented 3 months ago

Problem

Go templates which are used to generate Kubernetes manifests in Helm are difficult to write, read, debug and maintain. They have issues with performance, values mutability, template name collisions and others.

Solution (if you have one)

From what we know, Go templates cannot be improved much. We could add a few template functions to the library, the tooling can be improved, but not much else.

We should consider an alternative to Go templating in Nelm. This can be one of:

Another templating language won't solve much, so we left with general-purpose languages and specialized languages like Cue.

Additional information

Helm 3 has --post-renderer flag which allows usage of any other language to generate manifests, but it is rarely used due to:

  1. Chart developers can't enforce usage of specific post-renderer with a specific configuration for their chart. They must provide instructions to the chart consumers on how to manually set up the post-renderer and how to run it. Go templating works out-of-the box and requires no configuration.
  2. Ability to use any language results in chart consumers potentially required to learn many different languages just for Kubernetes manifest generation.
shurup commented 3 months ago

Specialized language

KCL is gaining momentum in the cloud native community right now. It joined CNCF last September only. According to the latest CNCF projects' velocity reports, it had:

Can't find an up-to-date list of new projects adopting it, though.

CUE is used by Timoni, so we can get some feedback from its users to see whether it's a good fit.