my photo

My personal bin to put stuff around, it will definitely change… or not? who knows


Composing helm deployments

📆: 2024-06-11 - 🏷: blog, helm, k8s


Finally understood how to make a helm deployment use another chart and configure it! I’ll show you how

Your main chart in the Chart.yaml file needs to specify dependencies in the dependencies block like so:

# Chart.yaml
dependencies: # A list of the chart requirements (optional)
  - name: prometheus-pushgateway # <- important!
    version: ^2.13.0
    repository: https://prometheus-community.github.io/helm-charts
    tags: # (optional)
      - pushgateway

⚠ Remember to helm dependency build!

Then in your values.yaml, a root-level key with the same name as your dependency (see the # <- important! remark) will provide values to the referred chart.

# values.yaml
prometheus-pushgateway:
  serviceAccount:
    create: no

And that will be passed down to the prometheus-pushgateway chart effectivelty not rendering the service account yaml file.

You can always validate it with helm template

helm template mychart -s charts/prometheus-pushgateway/templates/serviceaccount.yaml helm-chart/
Error: could not find template charts/prometheus-pushgateway/templates/serviceaccount.yaml in chart