1
00:00:00,000 --> 00:00:10,700
Hi, Let us understand about Pipeline and default values. Along with functions

2
00:00:10,700 --> 00:00:16,566
The pipeline will be used more frequently to add more value to the calculations..

3
00:00:16,566 --> 00:00:22,699
Say for example, I may want to convert a particular string into an uppercase and then do further processing

4
00:00:22,700 --> 00:00:26,800
by adding double quotes, then I might do some other operation.

5
00:00:26,800 --> 00:00:30,300
And this particular pipeline got derived from the linux concepts.

6
00:00:30,300 --> 00:00:33,100
Let's do some demo and get some better understanding.

7
00:00:33,100 --> 00:00:38,400
Let me get into the templates file, within templates

8
00:00:38,400 --> 00:00:43,133
I'm going to add. Let me open the YAML file.

9
00:00:43,133 --> 00:00:49,533
here I'm going to add couple of more lines.

10
00:00:49,533 --> 00:00:53,866
I am adding a key pipeline and I'm going to have a derivative where

11
00:00:53,866 --> 00:00:59,832
It's going to pick the value from Project code and that will be piped to a function called upper.

12
00:00:59,833 --> 00:01:03,133
So what will happen, the project code will be read from the values file.

13
00:01:03,133 --> 00:01:05,533
And it will be converted into uppercase.

14
00:01:05,533 --> 00:01:09,999
Then the output of it will be piped to another function called quote.

15
00:01:10,000 --> 00:01:16,900
So it's going to quote the output and put that as the final calculated value. The same way I do

16
00:01:16,900 --> 00:01:20,633
have another derivative where I do have a function called

17
00:01:20,633 --> 00:01:23,599
Now, that's going to get the current timestamp

18
00:01:23,600 --> 00:01:26,966
And it's going to pipe it to another function called date.

19
00:01:26,966 --> 00:01:30,366
And that's going to format the date in this particular order.

20
00:01:30,366 --> 00:01:35,432
And the way Go template works for the date
formatting is quite different.

21
00:01:35,433 --> 00:01:40,466
So you can verify the same page of sprig functions. Here

22
00:01:40,466 --> 00:01:44,799
A lot more details provided as a part of the date functions.

23
00:01:44,800 --> 00:01:51,366
You can get into this specific link to get more understanding about the usage of date formatting within

24
00:01:51,366 --> 00:01:54,866
go templates and output of it will be quoted.

25
00:01:54,866 --> 00:02:00,566
So here the current timestamp will be formatted in this particular structure and output will be enclosed

26
00:02:00,566 --> 00:02:03,366
within double quotes. So I'm storing the value

27
00:02:03,366 --> 00:02:05,432
Let me go ahead and do a dry run.

28
00:02:05,433 --> 00:02:14,433
Let me get into the location so that I can access the chart resources. Let me do the dry run.

29
00:02:14,433 --> 00:02:17,199
Here, say for example, the pipeline, what it did

30
00:02:17,200 --> 00:02:23,666
It took the project code converted that into uppercase and then enclosed within the double quotes the

31
00:02:23,666 --> 00:02:26,366
same way the next one

32
00:02:26,366 --> 00:02:33,266
It took the current timestamp converted into the structure that I had defined and enclosed within the double quotes.

33
00:02:33,266 --> 00:02:39,032
So this is one of the very useful functions when we are moving on to the condition, verifications or

34
00:02:39,033 --> 00:02:42,099
looping, lot more places this will be very, very useful.

35
00:02:42,100 --> 00:02:45,466
And to apply the logical operators this will be very useful.

36
00:02:45,466 --> 00:02:49,832
Along with this, we need to have understanding on the default value as well.

37
00:02:49,833 --> 00:02:53,133
Whenever we do some computation, we may not get the value

38
00:02:53,133 --> 00:02:57,999
Or that may not be available from the place where we are calculating the value.

39
00:02:58,000 --> 00:03:02,466
So we need to provide some default value so that it can be replaced.

40
00:03:02,466 --> 00:03:06,599
And the value is getting calculated to provide it to the template.

41
00:03:06,600 --> 00:03:12,066
Let me go ahead and add some additional details to the templates. Let me edit

42
00:03:12,066 --> 00:03:16,199
the yaml file. Here I'm going to provide another line.

43
00:03:16,200 --> 00:03:17,700
where I'm going to have a derivative.

44
00:03:17,700 --> 00:03:21,466
So it's going to pick the values contact from the values file.

45
00:03:21,466 --> 00:03:26,432
And I have not added the contact within the values file anyway we can go ahead and verify.

46
00:03:26,433 --> 00:03:32,099
And in case, if the value is not calculated or it is not derived from the values file, it is going

47
00:03:32,100 --> 00:03:34,900
to use this value as the default one.

48
00:03:34,900 --> 00:03:38,533
And it is going to add a code to it. For confirmation

49
00:03:38,533 --> 00:03:42,399
Let me go ahead and check the values yaml file as well. Here

50
00:03:42,400 --> 00:03:48,466
I do not have value for contact.

51
00:03:48,466 --> 00:03:56,732
Now, let me go ahead and do a dry run with this particular chart resources.

52
00:03:56,733 --> 00:03:58,099
It did not find the value.

53
00:03:58,100 --> 00:04:02,033
So it replaced the default value that we had provided.

54
00:04:02,033 --> 00:04:08,833
Now we can confirm this by setting the value as a part of the dry run so that we can check whether it

55
00:04:08,833 --> 00:04:11,666
is replacing the default value or not.

56
00:04:11,666 --> 00:04:17,599
Now, I'm going to run the dry run on the same chart resources I'm passing the contact value where

57
00:04:17,600 --> 00:04:20,933
I'm going to have 8888 in the end.

58
00:04:20,933 --> 00:04:26,433
So within the calculated value, it replaced the value that we provided as part of the command prompt

59
00:04:26,433 --> 00:04:33,366
using the argument --set. So in a quick summary we have seen how to use the pipeline and the default

60
00:04:33,366 --> 00:04:35,566
value within the templates.

