1
00:00:00,000 --> 00:00:12,733
Hi, Let us understand how to create our own values and use it within the template. Within our sample chart

2
00:00:12,733 --> 00:00:15,499
Let me get in to the values YAML file.

3
00:00:15,500 --> 00:00:17,966
I do have values.yaml file

4
00:00:17,966 --> 00:00:22,199
This one was created while using the chart create command

5
00:00:22,200 --> 00:00:27,000
I'm going to delete all the values and add my one value over here.

6
00:00:27,000 --> 00:00:30,400
So these are all the values which were added when the template was getting created.

7
00:00:30,400 --> 00:00:32,566
Let me delete all the values.

8
00:00:32,566 --> 00:00:37,232
I'm going to add a simple line with a key and value.

9
00:00:37,233 --> 00:00:43,533
So I do have a key cost code and value corresponding to that key is this.

10
00:00:43,533 --> 00:00:49,733
So we're going to read this specific key within the template and substitute that and make use of that

11
00:00:49,733 --> 00:00:56,099
within the templates. Let me go ahead and edit the template.

12
00:00:56,100 --> 00:00:59,333
I'm going to edit the config map.yaml

13
00:00:59,333 --> 00:01:03,599
Now I'm going to add another key value pair as a part of the data.

14
00:01:03,600 --> 00:01:06,466
So I'm going to add a key called cost code.

15
00:01:06,466 --> 00:01:15,932
And that's going to have a value read from the values file using the cost code. The Syntax is .values.costcode

16
00:01:15,933 --> 00:01:19,433
That was the key used within the values.yaml file.

17
00:01:19,433 --> 00:01:23,466
And that will be enclosed within double flower bracket.

18
00:01:23,466 --> 00:01:29,899
Now when I'm deploying this particular chart as a release, it's going to substitute the values and

19
00:01:29,900 --> 00:01:36,300
generate the right YAML file and deploy them, in case if I don't want to do the installation, say I

20
00:01:36,300 --> 00:01:37,800
don't want to make a release

21
00:01:37,800 --> 00:01:41,100
I just want to see how the values are getting substituted.

22
00:01:41,100 --> 00:01:43,366
I can use a dry run option.

23
00:01:43,366 --> 00:01:49,266
This is one of the commonly used command so that I can test it out before doing the release.

24
00:01:49,266 --> 00:01:51,932
So I do have the mychart template.

25
00:01:51,933 --> 00:02:04,399
Now I'm going to do a dry run. The command is helm install --debug --dry-run and then the name of the release

26
00:02:04,400 --> 00:02:10,466
And then the folder where we do have the chart resources.

27
00:02:10,466 --> 00:02:16,032
So it's going to substitute the values and generate the manifest file.

28
00:02:16,033 --> 00:02:19,099
And this is how the manifest file would get generated.

29
00:02:19,100 --> 00:02:24,400
If you see over here, we have a template derivative over here for the cost code and that's read

30
00:02:24,400 --> 00:02:27,300
from the values file and it got substituted.

31
00:02:27,300 --> 00:02:29,800
So this was the value that was computed.

32
00:02:29,800 --> 00:02:34,366
The reason why we have the computed values within values.YAML file

33
00:02:34,366 --> 00:02:37,599
We can have some computations to read.

34
00:02:37,600 --> 00:02:41,900
Data from other file or using some functions and calculate the value.

35
00:02:41,900 --> 00:02:44,566
Simple example date.

36
00:02:44,566 --> 00:02:49,199
So those computed values it's going to generate and that value will get substituted.

37
00:02:49,200 --> 00:02:51,800
In this case, we hardcoded the value.

38
00:02:51,800 --> 00:02:55,700
And the same value is substituted within the YAML file

39
00:02:55,700 --> 00:02:59,933
But there will not be any deployment for this particular operation.

40
00:02:59,933 --> 00:03:03,599
I can check using the helm ls. There is no releases.

41
00:03:03,600 --> 00:03:11,700
And in case, if I wanted to do the release, I can do it using helm install. Helm install name of the release

42
00:03:11,700 --> 00:03:17,400
And then the folder where we have the chart resources.

43
00:03:17,400 --> 00:03:23,000
So the values will be computed and that will be replaced within the template and template would get deployed.

44
00:03:23,000 --> 00:03:27,266
And I should have those config file within the kubernetes.

45
00:03:27,266 --> 00:03:29,332
So this was the name of the release.

46
00:03:29,333 --> 00:03:30,566
Let me check the release.

47
00:03:30,566 --> 00:03:33,999
helm ls, yes it got deployed

48
00:03:34,000 --> 00:03:38,300
In case if I wanted to check the values, what got deployed

49
00:03:38,300 --> 00:03:40,633
I can use manifest command.

50
00:03:40,633 --> 00:03:47,233
So I want to get the values that was used within the YAML file after doing the computation.

51
00:03:47,233 --> 00:03:49,166
The name of the config map should be this.

52
00:03:49,166 --> 00:03:58,599
I can get the details about this particular config map within the kubernetes. Yes, I do have.

53
00:03:58,600 --> 00:04:03,166
And here I do have the key costcode and the value corresponding to that

54
00:04:03,166 --> 00:04:10,299
Is this so successfully we are able to read a key value pair from the values file and substitute that within

55
00:04:10,300 --> 00:04:14,300
the templates and make use of that as a part of the installation.

56
00:04:14,300 --> 00:04:20,000
Along with that, we learned about how to do the dry run so that we can verify the computed value

57
00:04:20,000 --> 00:04:26,366
and how the YAML file will be generated for the test purpose, now to keep the system clean

58
00:04:26,366 --> 00:04:36,966
Let me go ahead and remove this particular installation, helm uninstall and name of the release.

59
00:04:36,966 --> 00:04:40,199
It is uninstalled. So there should not be any release now. After every demo

60
00:04:40,200 --> 00:04:45,000
I'm going to do the uninstallation so that the next demo will be clean and clear.

