“Behind every young child who believes in self, is a parent who believed first.” — Mathew Jacobson

Helm helps you manage and organise your applications in Kubernetes. You can group the kubernetes objects for your applications, like deployment, services, ingress etc as a helm chart and package them and distribute them. You get complete control and flexibility through its templating engine, that these artifacts can be hosted in git repositories and version controlled. This is the default choice when you progress to gitops model for continuous deployment of your applications.

But as your application grows, there will be a lot of dependent applications and you might want to define these dependencies as parent child charts. Your main project application consists of many k8s artifacts and the dependent artifacts. In this article, I am trying to relate the main chart and its dependent subcharts as parent and child charts and explain a simple and not so used dimension in exchanging values from child chart to parent chart.

In helm the parent chart overrides values in child charts. For this in Chart.yaml, we override the values for each child chart by having a section with the name of the subchart. We can also use global property which becomes accesible to all child charts and can be accessed easily in both.

global:
  my_global_var: "value"

This is accessed as {{ . Values.global.my_global_var }} across all parent and child charts. Thus the values defined in the parent chart takes precedence over values defined in child chart.

There will be situation, where we might need to pass variables from child chart to parent chart. This means the child’s values override the parents’ values. This is a rare situation, but often good to know about this feature in helm. “Let the child’s words be heard.”

There are 2 ways to make the childs value available to the parent.

#microservices #helm #devops

Helm: Child Chart to Parent Chart Data Exchange
1.85 GEEK