Hi, Let's understand about global values. In the earlier lecture we discussed about how to provide value for a subchart
from the main chart. We need to refer to the individual sub chart name and provide the value or overwrite the value
And whenever I wanted to have a common global value across the charts as well as its sub charts, it's
going to be difficult to inject or override the value for each and every subchart.
For that, we can use a concept called global value.
I can provide a global value as a part of the main chart
values file. Let me get in to the main chart values file.
And see through a small demo. Within values file
I'm going to add a key called Global
Within that I am going to have a collection of values.
So I do have a key called orgdomain and a value com.muthu4all
Now I can access this global value from the main chart or from any of the sub chart.
Let me modify the main chart template. As a part of the main chart template
I'm going to add value of domain. Let me go ahead and delete the other values. So I'm going to print the key or domain
and the value from global that is values.global. the key that I had provided within the values file
Now let me go ahead and modify the subchart as well.
For that, I'd be getting into the charts folder and then subchart folder.
So within my sub chart I will be getting into the templates folder. Within template
I will be modifying config map.yaml
Let me go ahead and add this specific same value.
I'm adding the key and accessing the value.
Using values.global.orgdomain, dot means
That's going to access the context specific to this particular template.
And within the template, global will also be accessible.
Now I can get into the parent directory and do a dry run on the parent directory.
That's going to build the subcharts as well
So here I will have the computed value. Within computed value
I do have the global and the global is available in the main computed value as well as within the
sub chart also. The sub chart we did not add it manually.
It got injected from the main chart and the same thing should be reflected within generated
yaml file as well. In the yaml file this is accessible. Calculating the computed values automatically
It's going to inject all the values that is put within the global in the main chart into its subchart
as well and because of that, the values will be accessible using the keys within the template as well.
The same value will be accessible within the main chart also.
So this is a quick demonstration on how to create or have a global value for the subchart so that I can have
some common values across the main chart as well as its subcharts.