temporalio / helm-charts

Temporal Helm charts
MIT License
276 stars 315 forks source link

Use tplvalues.render for templating inside values #492

Closed vogre closed 3 weeks ago

vogre commented 1 month ago

What was changed

Use templating for web.service annotations in the same way as server.service is defined https://github.com/temporalio/helm-charts/blob/bad8c74311717f2121579f64e2e6b1670fc19818/charts/temporal/templates/server-service.yaml#L15.

Why?

A very cool trick to allow passing templated values inside the values.yaml file instead of relying on an outside templating engine

Checklist

  1. Closes

  2. How was this tested: Added a template in values.yaml and ran helm template.

  3. Any docs updates needed? No

CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

CLAassistant commented 1 month ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Vladimir Zoubritsky seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

robholland commented 4 weeks ago

I know we already do this, and I'm happy to merge, but could you please explain what the use case is here so I can learn?

vogre commented 3 weeks ago

@robholland - we use it roughly like this:

e.g. by helm template --set foo=bar -f values_web.yaml, and values_web.yaml of

web:
  service:
    annotations:
      url: https://{{ $.Values.foo }}-temporal.example.com

We would utilize the templating features of helm, inside the values.yaml file (usually the templating only works in the templates/ directory.

Since this behavior is actually surprising - we could also set the value directly by

helm template --set 'web.service.annotations.url=https://bar-temporal.example.com'

Although it's a nice feature to allow extensibility of the template.