In this lesson, you will learn how to use the global object in Helm to inject shared configuration settings into multiple subcharts simultaneously.
The Challenge of Distributed Configuration
When working with complex "umbrella" charts—where one parent chart manages several child subcharts—you often encounter redundant configuration. For example, if your entire application suite needs to pull images from a specific private registry or share a common environment tag (like production or staging), defining these settings inside every individual values.yaml file creates maintenance overhead and increases the risk of configuration drift.
Leveraging the global Object
Helm provides a reserved key in the values.yaml file called global. Any value defined under this key is automatically accessible to the parent chart and all of its subcharts. By moving shared parameters into this global block, you create a single source of truth for your entire deployment.
Example Configuration
In your parent chart's values.yaml, define your shared settings like this:
global:
imageRegistry: my-private-registry.com
environment: production
Within the values.yaml of your subcharts, you don't need to define these variables. Instead, inside your subchart templates (such as a deployment.yaml), you access them using the .Values.global path:
spec:
containers:
- name: my-app
image: {{ .Values.global.imageRegistry }}/my-app:1.0.0
env:
- name: ENV_TYPE
value: {{ .Values.global.environment }}
Why This Matters
Using global values simplifies the management of complex stacks. If your security team decides to rotate your container registry, you only update one line in the umbrella chart’s values.yaml rather than digging through dozens of subcharts. Furthermore, because subcharts are essentially "namespaced" in Helm, global values ensure that common environmental data flows down the hierarchy cleanly without requiring manual overrides for every child component.
Key Takeaway: Use the global field in your parent values.yaml to propagate shared configuration variables across all subcharts, ensuring consistency and reducing configuration duplication.