1
00:00:00,000 --> 00:00:07,533
Hi, Let's understand about sub charts. Charts is a separate entity where

2
00:00:07,533 --> 00:00:10,699
It will be having collection of templates and values

3
00:00:10,700 --> 00:00:16,566
It can be packaged together, shared it within a repository as well as send it as a package to the

4
00:00:16,566 --> 00:00:21,566
external world and within charts. I can have n number of sub charts.

5
00:00:21,566 --> 00:00:26,232
Again, the subcharts will be having a collection of templates and values and the same hierarchy

6
00:00:26,233 --> 00:00:28,433
How we have within the charts.

7
00:00:28,433 --> 00:00:30,199
Let's understand through a demo.

8
00:00:30,200 --> 00:00:35,366
Let me get into the sample chart that we have, within that we do have charts folder.

9
00:00:35,366 --> 00:00:38,266
I'm going to get into the charts folder, within charts folder

10
00:00:38,266 --> 00:00:40,532
I'm going to create a subchart.

11
00:00:40,533 --> 00:00:47,033
The name of the subchart I'll give it is mysubchart and I will use helm create command, helm create

12
00:00:47,033 --> 00:00:51,899
mysubchart. So within charts it's going to create a folder.

13
00:00:51,900 --> 00:00:54,300
mysubchart and like this I can have

14
00:00:54,300 --> 00:00:58,800
n number of charts within it and within the folder

15
00:00:58,800 --> 00:01:01,300
By default it is going to create a project

16
00:01:01,300 --> 00:01:04,033
And within that it's going to create the collection of required folders

17
00:01:04,033 --> 00:01:06,799
And it's going to create the sample templates

18
00:01:06,800 --> 00:01:09,800
And that will be available within the templates.

19
00:01:09,800 --> 00:01:16,666
So within templates, I'm going to have all the sample manifest file for that particular sample chart.

20
00:01:16,666 --> 00:01:20,732
Now I'm going to remove all this so that I can create right from the beginning.

21
00:01:20,733 --> 00:01:23,199
Everything is a removed.

22
00:01:23,200 --> 00:01:29,033
Within mychart I am having mysubchart as another subchart. Within mysubchart

23
00:01:29,033 --> 00:01:35,499
I'm going to add some values.

24
00:01:35,500 --> 00:01:39,933
I delete all the values within the values file as well.

25
00:01:39,933 --> 00:01:42,633
I'm going to add a sample key value pair.

26
00:01:42,633 --> 00:01:49,533
I'm adding a key value pair named dbhostname as key and mysql node known as value.

27
00:01:49,533 --> 00:01:53,633
Now let me go ahead and create a template.

28
00:01:53,633 --> 00:01:54,666
I don't have any files.

29
00:01:54,666 --> 00:02:02,599
I'm going to create a file called config map.yaml, let me add some sample content within it.

30
00:02:02,600 --> 00:02:06,200
So this is going to create a config map where the name

31
00:02:06,200 --> 00:02:11,466
It will have the release name and as a part of the dbhost key its going to have the value

32
00:02:11,466 --> 00:02:17,066
from the values file so it will read the value with the key dbhost name.

33
00:02:17,066 --> 00:02:20,666
Now I can try only this specific subchart.

34
00:02:20,666 --> 00:02:27,166
Let me get into the parent directory mychart here I do have the project mychart

35
00:02:27,166 --> 00:02:31,332
I'm going to do a dry run on my subchart.

36
00:02:31,333 --> 00:02:38,599
If you observe over here, here I have given the entire path within the chart that my subchart directory I have provided.

37
00:02:38,600 --> 00:02:44,733
So it's going to do a dry run and process the values file and generate the manifest file and it replaced

38
00:02:44,733 --> 00:02:50,666
the dbhost with the value that we provided as a part of the values file.

39
00:02:50,666 --> 00:02:53,032
So this is going to work as a separate entity

40
00:02:53,033 --> 00:02:56,099
And like this, I can have n number of subcharts

41
00:02:56,100 --> 00:03:02,633
And in case, if I wanted to override this particular value from the parent directory I can very well

42
00:03:02,633 --> 00:03:07,599
do that. Let me give a try within mychart

43
00:03:07,600 --> 00:03:11,433
I am going to update the values file. So within values file

44
00:03:11,433 --> 00:03:17,099
I'm going to add or inject values to the subchart

45
00:03:17,100 --> 00:03:21,266
So I'm having a collection, mysubchart the key dbhostname.

46
00:03:21,266 --> 00:03:26,799
And I'm providing the value as prod mysql node as the value.

47
00:03:26,800 --> 00:03:32,733
Now, let me go ahead and build the mychart and see how the value is getting generated.

48
00:03:32,733 --> 00:03:39,933
This time I'm going to do a dry run against mychart and mychart is providing the value to the subchart as well.

49
00:03:39,933 --> 00:03:43,733
So if I look into the computed values mysubchart

50
00:03:43,733 --> 00:03:47,266
It's having prodmysqlnode

51
00:03:47,266 --> 00:03:54,399
And this is the value that it calculated within the sub chart because that is coming from the parent

52
00:03:54,400 --> 00:03:58,300
So the computed value, it's being provided from the parent chart

53
00:03:58,300 --> 00:04:01,700
And that will be fed into the mysubchart

54
00:04:01,700 --> 00:04:04,733
And mysubchart got the prodmysqlnode

55
00:04:04,733 --> 00:04:07,466
And that is from the parent chart.

56
00:04:07,466 --> 00:04:13,132
So this is how I can override the value that needs to be provided to the subchart as well

57
00:04:13,133 --> 00:04:18,298
And there is another concept called global values that we will be discussing it in the next lecture.

58
00:04:18,300 --> 00:04:21,766
So in a quick summary we have seen how to create subchart and override

59
00:04:21,766 --> 00:04:25,132
The value of the subchart from the parent chart.

