How to maintain a single Helm chart template for multiple platforms?

98 Views Asked by At

I am working on a project where I need to release several Helm charts for different platforms such as Google Marketplace, Azure Marketplace, and Openshift. The majority of these charts are interconnected and shared.

My goal is to maintain a single Helm chart/template and generate multiple Helm charts from this template using different value files. However, options not relevant to a specific chart must be hidden from the users.

I've attempted a couple of solutions but ran into issues:

  1. Golang Template: I tried using the Golang template for the main chart. However, the Helm chart template syntax is identical to the Golang template syntax. This caused the Golang template to process the Helm chart template as well, which is not what I intended.

  2. ytt: I also experimented with ytt, but it requires the input and output to be valid YAML or a template based on ytt syntax. It crashes when there are Golang template syntax elements in the Helm template.

I considered using Helm sub-charts and dependencies, but they don't seem to fit this use case as they are the same component with different values.

I would appreciate any suggestions or alternative approaches to solve this problem.

How can I maintain a single Helm chart template and generate multiple charts for different platforms?

1

There are 1 best solutions below

1
Muravyev Maxim On

It seems Helm templates solely are not enough to achieve your goal.

You can keep Helm templating for single-cluster deployment. But put PKL in charge of generating multiple values files. This approach should work if you write some PKL script to generate the vendor's YAMLs and properly configure it on CI to publish each vendor's chart with appropriate default values.

You can be skeptical about PKL as it's new. However, Apple has used it internally for a long time. There are Kubernetes examples.

Actually, you can use any high-level language like Python to accomplish it, but PLK seems to be a better fit.