1
00:00:00,000 --> 00:00:11,633
Hi, Let's understand about global values. In the earlier lecture we discussed about how to provide value for a subchart

2
00:00:11,633 --> 00:00:18,799
from the main chart. We need to refer to the individual sub chart name and provide the value or overwrite the value

3
00:00:18,800 --> 00:00:25,666
And whenever I wanted to have a common global value across the charts as well as its sub charts, it's

4
00:00:25,666 --> 00:00:30,599
going to be difficult to inject or override the value for each and every subchart.

5
00:00:30,600 --> 00:00:33,633
For that, we can use a concept called global value.

6
00:00:33,633 --> 00:00:37,099
I can provide a global value as a part of the main chart

7
00:00:37,100 --> 00:00:41,633
values file. Let me get in to the main chart values file.

8
00:00:41,633 --> 00:00:45,099
And see through a small demo. Within values file

9
00:00:45,100 --> 00:00:47,500
I'm going to add a key called Global

10
00:00:47,500 --> 00:00:51,066
Within that I am going to have a collection of values.

11
00:00:51,066 --> 00:00:56,632
So I do have a key called orgdomain and a value com.muthu4all

12
00:00:56,633 --> 00:01:01,633
Now I can access this global value from the main chart or from any of the sub chart.

13
00:01:01,633 --> 00:01:05,498
Let me modify the main chart template. As a part of the main chart template

14
00:01:05,500 --> 00:01:14,766
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

15
00:01:14,766 --> 00:01:22,366
and the value from global that is values.global.
the key that I had provided within the values file

16
00:01:22,366 --> 00:01:25,199
Now let me go ahead and modify the subchart as well.

17
00:01:25,200 --> 00:01:29,000
For that, I'd be getting into the charts folder and then subchart folder.

18
00:01:29,000 --> 00:01:34,733
So within my sub chart I will be getting into the templates folder. Within template

19
00:01:34,733 --> 00:01:38,633
I will be modifying config map.yaml

20
00:01:38,633 --> 00:01:42,633
Let me go ahead and add this specific same value.

21
00:01:42,633 --> 00:01:44,699
I'm adding the key and accessing the value.

22
00:01:44,700 --> 00:01:48,566
Using values.global.orgdomain, dot means

23
00:01:48,566 --> 00:01:53,632
That's going to access the context specific to this particular template.

24
00:01:53,633 --> 00:01:57,466
And within the template, global will also be accessible.

25
00:01:57,466 --> 00:02:03,499
Now I can get into the parent directory and do a dry run on the parent directory.

26
00:02:03,500 --> 00:02:06,500
That's going to build the subcharts as well

27
00:02:06,500 --> 00:02:09,800
So here I will have the computed value. Within computed value

28
00:02:09,800 --> 00:02:16,866
I do have the global and the global is available in the main computed value as well as within the

29
00:02:16,866 --> 00:02:20,966
sub chart also. The sub chart we did not add it manually.

30
00:02:20,966 --> 00:02:26,532
It got injected from the main chart and the same thing should be reflected within generated

31
00:02:26,533 --> 00:02:32,566
yaml file as well. In the yaml file this is accessible. Calculating the computed values automatically

32
00:02:32,566 --> 00:02:37,999
It's going to inject all the values that is put within the global in the main chart into its subchart

33
00:02:38,000 --> 00:02:45,400
as well and because of that, the values will be accessible using the keys within the template as well.

34
00:02:45,400 --> 00:02:49,666
The same value will be accessible within the main chart also.

35
00:02:49,666 --> 00:02:56,166
So this is a quick demonstration on how to create or have a global value for the subchart so that I can have

36
00:02:56,166 --> 00:03:00,899
some common values across the main chart as well as its subcharts.

