<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Optional: 7. Create your own chart on Helm Basics Training</title><link>/docs/07/</link><description>Recent content in Optional: 7. Create your own chart on Helm Basics Training</description><generator>Hugo</generator><language>en</language><atom:link href="/docs/07/index.xml" rel="self" type="application/rss+xml"/><item><title>7.1 Refactor 1</title><link>/docs/07/01_refactor_1/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/07/01_refactor_1/</guid><description>&lt;h2 id="task-711-make-the-ingress-resource-more-configurable">Task 7.1.1: Make the Ingress resource more configurable&lt;/h2>
&lt;p>After cloning the repository and inspecting the templates already created for you, you will notice some potential for improvement. For example the hostname of the applications should not be hard-coded. When deploying to multiple environments you will run into conflicts.&lt;/p>
&lt;p>Modify the &lt;strong>consumer and producer&lt;/strong> ingress templates and extract following variables to make them configurable:&lt;/p>
&lt;ul>
&lt;li>Extract &lt;code>.spec.rules.host&lt;/code> as value&lt;/li>
&lt;li>Extract &lt;code>.spec.tls.hosts[0]&lt;/code> as value, use the same value as above&lt;/li>
&lt;/ul>


&lt;div class="alert alert-info" role="alert">
&lt;h4 class="alert-heading">Note&lt;/h4>

&lt;p>If you want to test the chart locally you can execute following command&lt;/p></description></item><item><title>7.2 Refactor 2</title><link>/docs/07/02_refactor_2/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/07/02_refactor_2/</guid><description>&lt;p>If you take a closer look at your Chart you will still recognize some weak spots. For example the producer and consumer will look like a lot of code duplication. We don&amp;rsquo;t like code duplication at all! The only big difference is the &lt;code>&amp;quot;consumer&amp;quot;&lt;/code> or &lt;code>&amp;quot;producer&amp;quot;&lt;/code> pre- or suffixed everywhere.&lt;/p>
&lt;p>&lt;strong>Just for fun:&lt;/strong> How much lines of code are actually different?&lt;/p>
&lt;details >
 &lt;summary>Hint / Solution&lt;/summary>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bc -l &lt;span style="color:#ce5c00;font-weight:bold">&amp;lt;&amp;lt;&amp;lt;&lt;/span> &lt;span style="color:#4e9a06">&amp;#34;&lt;/span>&lt;span style="color:#204a87;font-weight:bold">$(&lt;/span>diff -U0 templates/consumer-deployment.yaml templates/producer-deployment.yaml &lt;span style="color:#000;font-weight:bold">|&lt;/span> wc -l&lt;span style="color:#204a87;font-weight:bold">)&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;&lt;/span>/2
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/details>
&lt;p>When considering the differences and how they affect the service, we can easily see the flaw of this Chart. The entire Chart is a duplication. Both services could use the same Chart and just be two instances / releases!&lt;/p></description></item><item><title>7.3 Composition</title><link>/docs/07/03_composition/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/07/03_composition/</guid><description>&lt;p>Instead of instantiating the Chart two times manually by hand, we can also define a composition of two Charts in a single Chart. In other 2words we create a new Helm Chart and add the Chart we just wrote twice as a dependency to the chart.&lt;/p>
&lt;p>In Helm we can make a composition of already existing Charts and own templates and define it as a new Chart. This is a very common use case if we mix self created resources with own templated resources.&lt;/p></description></item></channel></rss>