WEBVTT 00:00.240 --> 00:04.740 OK, and the last lesson, what we did is we defined and set up a proxy. 00:05.310 --> 00:07.340 Now let's go ahead and use it. 00:07.920 --> 00:11.820 Now, if we go back to our deployment now, let's include the statement. 00:12.000 --> 00:15.720 Some people like to include a statement at the beginning of a line like this. 00:16.170 --> 00:20.340 And personally, for me, I don't like that it looks a bit messy and it can make it a bit harder to 00:20.340 --> 00:22.130 read in this case here. 00:22.500 --> 00:27.240 If you had multiple containers, you would use this line of indentation here. 00:27.360 --> 00:31.890 And because we're all going to be adding a second one, I think is the perfect place to put the if statement. 00:32.880 --> 00:34.590 So let's do that now, let's put in. 00:35.720 --> 00:36.740 Double Kelly versus. 00:38.110 --> 00:43.480 A two dashes and again, this is to prevent Helme from putting it on a new line which would actually 00:43.480 --> 00:49.900 break the code using if statement, it's if and then we have different operators. 00:50.380 --> 00:55.900 I'll include a link to this because there are so many you can use and you got a really wide array of 00:55.900 --> 00:56.740 different options. 00:56.980 --> 01:01.850 But what we're interested in are probably the most common one is going to be Q or equal. 01:02.350 --> 01:07.720 Next, we need to define something to check against and the best place to put this is inside a values 01:07.720 --> 01:08.050 file. 01:08.290 --> 01:09.720 So let's use this example here. 01:10.060 --> 01:16.570 We want to say that this proxy is only enabled in production, maybe has some certs or is a special 01:16.570 --> 01:20.140 reason why we need it, but is only enabled in production. 01:20.530 --> 01:23.290 So we could do is set it up, something like this. 01:23.800 --> 01:26.800 Dot values, dot proxy. 01:27.830 --> 01:36.170 Dots enabled and we'll say true, serving the values fall proxy is set to enabled, and it sets a true 01:36.650 --> 01:39.080 then go ahead and add for proxy. 01:39.620 --> 01:46.850 Certain values fall right at the beginning of a line or set proxy enabled. 01:48.140 --> 01:54.050 And we said the default option in this case values, because it's the default will set about to force 01:54.320 --> 01:54.950 in production. 01:54.960 --> 01:56.600 However, we do want it enabled. 01:57.050 --> 02:03.820 So it will do is we set it to proxy enabled and also. 02:03.860 --> 02:04.440 That's true. 02:04.790 --> 02:05.370 Excellent. 02:06.120 --> 02:08.860 So now back in a deployment, let's continue your statement. 02:09.470 --> 02:12.350 So we're saying if it's true, what do I want you to do? 02:13.010 --> 02:15.290 Well, in that case, we want to include our template. 02:16.250 --> 02:21.140 And again, we going to use include because we need to indent it and remember as before, we need to 02:21.140 --> 02:23.330 delete that second dash. 02:24.230 --> 02:25.430 So when you say include. 02:26.900 --> 02:31.610 For me to say which template in this case, it's going to be proxy. 02:32.740 --> 02:36.970 And one of the things we've held, and it's a bit like telephone, if you've used that before, is that 02:36.970 --> 02:43.190 it looks inside a folder and effectively takes inventory of all the files inside and everything to create. 02:43.330 --> 02:45.480 So we don't need to like some programming languages. 02:45.490 --> 02:50.170 We'd have to define exactly which template to use, and you'd have to include the file for Helme to 02:50.170 --> 02:50.830 be aware of it. 02:51.010 --> 02:56.620 It's aware of everything inside this folder, then pass in a context where we want to include it. 02:56.830 --> 03:03.910 Full stop to say right here, then we need to pipe it and we need to put each line onto a new line so 03:03.910 --> 03:08.380 we can use an indent if we need to work out the spacing. 03:08.690 --> 03:12.940 So let's have a look at how many spaces don't be afraid to count Weasel's. 03:13.060 --> 03:17.320 As the famous saying goes, if it's stupid and it works, it's not stupid. 03:17.800 --> 03:20.260 I've only been there and counted out the lines. 03:20.380 --> 03:25.330 And while some people have looked to me a bit funny, the fact is the code words and it's a trusted 03:25.330 --> 03:25.870 way of doing it. 03:25.870 --> 03:26.680 So let's count it out. 03:26.680 --> 03:30.670 One, two, three, four, five, six, seven, eight, eight spaces. 03:31.060 --> 03:35.770 And before to quickly recap, we're not using a dash because what it does is it contradicts this new 03:35.770 --> 03:36.370 line here. 03:36.700 --> 03:38.110 We're saying put it on a new line. 03:38.260 --> 03:41.980 And by putting a dash here, we're saying don't create a new line. 03:43.090 --> 03:50.650 OK, now it's time to go ahead and template this out, so let's go to the terminal, minimize that and 03:50.650 --> 03:57.810 let's run hele template full stop dash f values, dot yaml. 03:58.180 --> 04:02.430 And what we expect to see here is that the proxy isn't available. 04:02.980 --> 04:04.540 So let's go ahead and enter. 04:06.490 --> 04:07.000 Awesome. 04:07.390 --> 04:11.900 So what we see here in the containers is that we only have the Ingenix container. 04:13.270 --> 04:16.000 Now let's go ahead and clip it out, press up. 04:16.330 --> 04:18.970 What we want to use is the production values. 04:19.420 --> 04:20.640 So let's go ahead and enter. 04:21.550 --> 04:22.110 Awesome. 04:22.660 --> 04:26.080 Now see how we have a proxy container enabled. 04:26.410 --> 04:31.150 So this is a really, really powerful way of using Helme templating. 04:31.390 --> 04:34.540 Another client I worked with had a very different way of doing this. 04:34.540 --> 04:40.450 When he put everything inside a template, the service for deployment, a pod definition, everything 04:40.750 --> 04:44.560 went inside a template and it was almost like Lego bricks. 04:44.560 --> 04:50.170 You could pick and choose what you wanted to use because it had to be standard across all the teams 04:50.200 --> 04:55.160 is quite an efficient way of making central changes because everything could just be pulled in as required. 04:55.360 --> 05:00.500 Your mileage may vary, but again, this is a really powerful way of using Helme templating. 05:00.520 --> 05:03.640 And what we're going to do next is expand on the if statements. 05:04.030 --> 05:06.130 I look forward to seeing you in that lesson.