1
00:00:00,000 --> 00:00:11,266
Hi, Let us understand about Dependency. As we discussed earlier as a part of helm I'll be maintaining a chart and within chart

2
00:00:11,266 --> 00:00:17,866
I can maintain n number of sub charts and I can manually go ahead and create the sub chart and maintain

3
00:00:17,866 --> 00:00:23,299
the charts as modules so that I will be having the separation of the concern.

4
00:00:23,300 --> 00:00:29,633
Now, having the subchart being maintained as a part of the main chart is going to be little tedious.

5
00:00:29,633 --> 00:00:32,732
when I'm going to have more number of subcharts.

6
00:00:32,732 --> 00:00:39,466
Rather, I can maintain the subchart as another chart and maintain that as a separate project and

7
00:00:39,466 --> 00:00:44,666
add that as a dependency so I can add another chart as a dependency

8
00:00:44,666 --> 00:00:50,899
Something like depends on chart a version 1.0
on the chart

9
00:00:50,900 --> 00:00:54,866
It can be managed as a separate master chart.

10
00:00:54,866 --> 00:01:01,099
So when that is being managed the chart itself can be managed as a separate project that can be added within

11
00:01:01,100 --> 00:01:05,132
the repository and different versions can be managed and maintained.

12
00:01:05,132 --> 00:01:11,299
And I can add the dependency of that particular chart within the main chart and automatically helm can

13
00:01:11,300 --> 00:01:15,566
import those charts. This is what will be handled within the dependency.

14
00:01:15,566 --> 00:01:20,966
Let's go ahead and see a small demo. I'm going to create a sample chart.

15
00:01:20,966 --> 00:01:24,899
Let me create a chart with the name dependencytest.

16
00:01:24,900 --> 00:01:26,700
I can install this particular chart

17
00:01:26,700 --> 00:01:31,466
This time I'm going to set the service type as nodeport

18
00:01:31,466 --> 00:01:33,499
So what will happen it'll attach the

19
00:01:33,500 --> 00:01:39,266
service port to the nodeport so that I will be in a position to access that specific service.

20
00:01:39,266 --> 00:01:45,466
And the name of the install is mydeptestinstall and by default the sample

21
00:01:45,466 --> 00:01:52,332
It's going to create an nginx and it will get deployed in the nodeport.

22
00:01:52,333 --> 00:01:55,299
So this particular service is deployed as a part of node port.

23
00:01:55,300 --> 00:02:00,400
And it is serving in port 32021.

24
00:02:00,400 --> 00:02:02,600
And it is running in this specific machine.

25
00:02:02,600 --> 00:02:08,000
And this is the port I will be in a position to access nginx.

26
00:02:08,000 --> 00:02:11,066
Now, let me go ahead and update the values file.

27
00:02:11,066 --> 00:02:19,799
I'm getting into the chart. I'm updating the values file as a part of repository

28
00:02:19,800 --> 00:02:26,333
Let me go ahead and change the repository to my own project and tag as

29
00:02:26,333 --> 00:02:31,466
1.0.0 as a part of my docker hub repository

30
00:02:31,466 --> 00:02:34,699
I do have this particular application to do. Lets assume

31
00:02:34,700 --> 00:02:38,333
This particular application depends on another image.

32
00:02:38,333 --> 00:02:43,899
Say mariadb I need to add the dependency as a part of the charts yaml file.

33
00:02:43,900 --> 00:02:47,300
Now I have this particular repository.

34
00:02:47,300 --> 00:02:51,333
Let me go ahead and update the charts.yaml file. Here

35
00:02:51,333 --> 00:02:55,999
I need to add the dependency.

36
00:02:56,000 --> 00:03:00,666
So I have added the dependencies and the name of the dependency is mariadb the version

37
00:03:00,666 --> 00:03:04,732
And it will be picking from this specific repository. Like this

38
00:03:04,733 --> 00:03:07,233
I can have n number of dependency.

39
00:03:07,233 --> 00:03:11,299
Now I can go ahead and deploy this particular chart.

40
00:03:11,300 --> 00:03:17,366
And before that, I need to do the build of this particular dependency so that it can import this

41
00:03:17,366 --> 00:03:27,932
required dependent charts. Let me go ahead and do the build helm dependency build ./name of the chart.

42
00:03:27,933 --> 00:03:32,966
So it's going to do the update of the repository and all the dependency chart as well.

43
00:03:32,966 --> 00:03:35,366
It identified it depends on mariadb

44
00:03:35,366 --> 00:03:41,199
so it's going to pull the mariadb dependent chart and any outdated charts which are there in the cache will

45
00:03:41,200 --> 00:03:49,966
also get deleted. Now, if I get into this particular folder within charts, I should have the mariadb imported.

46
00:03:49,966 --> 00:03:58,166
This way I will be in a position to maintain the subchart as a separate project and that can follow its own lifecycle.

47
00:03:58,166 --> 00:04:03,432
And in case, if I feel any of the versions or any change happen to the charts.yaml file or

48
00:04:03,433 --> 00:04:10,299
on the dependent charts I can go ahead and do the update using the command helm dependency update ./

49
00:04:10,300 --> 00:04:15,733
And then the chart folder, it will keep itself up to date.

50
00:04:15,733 --> 00:04:20,933
Now using this particular chart, I can go ahead and do the deployment.

51
00:04:20,933 --> 00:04:24,566
Let me go ahead and list the deployments available.

52
00:04:24,566 --> 00:04:29,732
This one was created with the basic example that got created automatically.

53
00:04:29,733 --> 00:04:34,833
Now I'm going to do another deployment with the same chart.

54
00:04:34,833 --> 00:04:40,199
helm install name of the deployment and the folder where I do have the resources.

55
00:04:40,200 --> 00:04:48,433
Then I will set the service type equal to nodeport.

56
00:04:48,433 --> 00:04:55,566
Let me go ahead and list the pods that got deployed kubectl get all

57
00:04:55,566 --> 00:05:03,732
So as a part of the pods I should have this particular pod depwithmaria here I do have the

58
00:05:03,733 --> 00:05:09,599
mariadb that is getting deployed, master and slave the same way I will be having the

59
00:05:09,600 --> 00:05:13,200
required services and the required components.

60
00:05:13,200 --> 00:05:19,400
So this is biggest advantage of maintaining the dependency, I can maintain all the dependent projects

61
00:05:19,400 --> 00:05:20,833
and automatically helm

62
00:05:20,833 --> 00:05:27,399
going to import that specific chart and deploy them together so that the maintenance of the subchart will

63
00:05:27,400 --> 00:05:30,933
also be much easier and it can follow its own lifecycle

64
00:05:30,933 --> 00:05:33,666
And the main project can follow its own lifecycle.

65
00:05:33,666 --> 00:05:41,399
And the dependency command of build and update will facilitate to keep the dependent charts up to date.

66
00:05:41,400 --> 00:05:51,700
Now let me go ahead and delete those installations helm uninstall

67
00:05:51,700 --> 00:06:01,300
name of the deployment, the other one that we did for testing that also I'm removing it.

68
00:06:01,300 --> 00:06:08,033
We do not have any installation. Let me check the kubernetes cluster as well. Here also the services, pods and

69
00:06:08,033 --> 00:06:10,399
other components are removed.

70
00:06:10,400 --> 00:06:16,166
So in a quick summary we learnt about how to maintain the dependency and how to add the dependency details

71
00:06:16,166 --> 00:06:21,199
as a part of the chart.yaml file and how to add the dependency as a part of the charts.yaml

72
00:06:21,200 --> 00:06:27,300
file and how to keep the dependency up to date using the update command and build it in the

73
00:06:27,300 --> 00:06:29,366
beginning using the built command.

