Additional helm template or template override


#1

Is there a way to pull a helm chart down and have an additional helm template be included prior to running Kustomize?

For example, I may have a helm chart that doesn’t have something like a NetworkPolicy. I want to add that template in so that it is still run through the helm templating engine. I want a template in this case because there is more logic required than just a simple override.

Along the same lines, what if I want to just override the template with my own template?

Thanks


#2

Is there a way to pull a helm chart down and have an additional helm template be included prior to running Kustomize?

This is possible! But not with the default lifecycle. It’ll require making a ship.yaml (or a ship app), since typically an end user of a helm app won’t need more than a simple override. (logic is only really useful when you’re producing rendered yaml for a variety of clusters)

Essentially, what you’re going to need to do is to download the upstream helm chart as an asset (for example, github) and then add your additional helm files to that directory. You can then use a helm asset with the “local” source to render your frankenchart.

The default helm chart lifecycle might help you here, though it is unfortunately a go struct and not yaml.

Along the same lines, what if I want to just override the template with my own template?

What do you mean?


#3

This is possible! But not with the default lifecycle. It’ll require making a ship.yaml

Cool. I was just starting to look at that.

Along the same lines, what if I want to just override the template with my own template?

What do you mean?

There are 2 scenarios…

  1. The helm template in the chart doesn’t exist at all in the chart, so I want to add it. I think you covered this above with the ship.yaml
  2. The helm template in the chart exists, but it isn’t what we need, so we want to override it with a custom template. Often this might be something you are testing out before submitting a patch to the upstream chart or maybe a change to the chart that won’t be upstreamed because it is bespoke… but it requires the template logic and not just a simple kustomize override.

#4

Sorry for the slow reply here!

  1. The helm template in the chart doesn’t exist at all in the chart, so I want to add it. I think you covered this above with the ship.yaml

Yeah, this sounds like it can be covered by adding files, which ship’ll do fine.

  1. The helm template in the chart exists, but it isn’t what we need, so we want to override it with a custom template. Often this might be something you are testing out before submitting a patch to the upstream chart or maybe a change to the chart that won’t be upstreamed because it is bespoke… but it requires the template logic and not just a simple kustomize override.

There’s a couple things to break down here. First off - if you have a branch with the patch on it, ship can refer to that branch just fine. That might work for testing there.

For bespoke changes requiring logic and overriding existing helm template logic, ship isn’t really set up for that :frowning:. That being said, if you can formulate your changes as a set of dynamically generated kustomize patches, you should be able to programmatically render them with the use of golang templates and our config page. It would add an extra layer of configuration (helm values file + ship config screen) but that’s the best I can think of right now.