OK, and the last lesson, what we did is we defined and set up a proxy.
Now let's go ahead and use it.
Now, if we go back to our deployment now, let's include the statement.
Some people like to include a statement at the beginning of a line like this.
And personally, for me, I don't like that it looks a bit messy and it can make it a bit harder to
read in this case here.
If you had multiple containers, you would use this line of indentation here.
And because we're all going to be adding a second one, I think is the perfect place to put the if statement.
So let's do that now, let's put in.
Double Kelly versus.
A two dashes and again, this is to prevent Helme from putting it on a new line which would actually
break the code using if statement, it's if and then we have different operators.
I'll include a link to this because there are so many you can use and you got a really wide array of
different options.
But what we're interested in are probably the most common one is going to be Q or equal.
Next, we need to define something to check against and the best place to put this is inside a values
file.
So let's use this example here.
We want to say that this proxy is only enabled in production, maybe has some certs or is a special
reason why we need it, but is only enabled in production.
So we could do is set it up, something like this.
Dot values, dot proxy.
Dots enabled and we'll say true, serving the values fall proxy is set to enabled, and it sets a true
then go ahead and add for proxy.
Certain values fall right at the beginning of a line or set proxy enabled.
And we said the default option in this case values, because it's the default will set about to force
in production.
However, we do want it enabled.
So it will do is we set it to proxy enabled and also.
That's true.
Excellent.
So now back in a deployment, let's continue your statement.
So we're saying if it's true, what do I want you to do?
Well, in that case, we want to include our template.
And again, we going to use include because we need to indent it and remember as before, we need to
delete that second dash.
So when you say include.
For me to say which template in this case, it's going to be proxy.
And one of the things we've held, and it's a bit like telephone, if you've used that before, is that
it looks inside a folder and effectively takes inventory of all the files inside and everything to create.
So we don't need to like some programming languages.
We'd have to define exactly which template to use, and you'd have to include the file for Helme to
be aware of it.
It's aware of everything inside this folder, then pass in a context where we want to include it.
Full stop to say right here, then we need to pipe it and we need to put each line onto a new line so
we can use an indent if we need to work out the spacing.
So let's have a look at how many spaces don't be afraid to count Weasel's.
As the famous saying goes, if it's stupid and it works, it's not stupid.
I've only been there and counted out the lines.
And while some people have looked to me a bit funny, the fact is the code words and it's a trusted
way of doing it.
So let's count it out.
One, two, three, four, five, six, seven, eight, eight spaces.
And before to quickly recap, we're not using a dash because what it does is it contradicts this new
line here.
We're saying put it on a new line.
And by putting a dash here, we're saying don't create a new line.
OK, now it's time to go ahead and template this out, so let's go to the terminal, minimize that and
let's run hele template full stop dash f values, dot yaml.
And what we expect to see here is that the proxy isn't available.
So let's go ahead and enter.
Awesome.
So what we see here in the containers is that we only have the Ingenix container.
Now let's go ahead and clip it out, press up.
What we want to use is the production values.
So let's go ahead and enter.
Awesome.
Now see how we have a proxy container enabled.
So this is a really, really powerful way of using Helme templating.
Another client I worked with had a very different way of doing this.
When he put everything inside a template, the service for deployment, a pod definition, everything
went inside a template and it was almost like Lego bricks.
You could pick and choose what you wanted to use because it had to be standard across all the teams
is quite an efficient way of making central changes because everything could just be pulled in as required.
Your mileage may vary, but again, this is a really powerful way of using Helme templating.
And what we're going to do next is expand on the if statements.
I look forward to seeing you in that lesson.