<?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-us</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"&gt;Task 7.1.1: Make the Ingress resource more configurable&lt;/h2&gt;
&lt;p&gt;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&gt;
&lt;p&gt;Modify the &lt;strong&gt;consumer and producer&lt;/strong&gt; ingress templates and extract following variables to make them configurable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Extract &lt;code&gt;.spec.rules.host&lt;/code&gt; as value&lt;/li&gt;
&lt;li&gt;Extract &lt;code&gt;.spec.tls.hosts[0]&lt;/code&gt; as value, use the same value as above&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;If you want to test the chart locally you can execute following command&lt;/p&gt;</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&gt;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&gt;&amp;quot;consumer&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;producer&amp;quot;&lt;/code&gt; pre- or suffixed everywhere.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Just for fun:&lt;/strong&gt; How much lines of code are actually different?&lt;/p&gt;
&lt;details &gt;
 &lt;summary&gt;Hint / Solution&lt;/summary&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;bc -l &lt;span style="color:#ce5c00;font-weight:bold"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style="color:#4e9a06"&gt;&amp;#34;&lt;/span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;$(&lt;/span&gt;diff -U0 templates/consumer-deployment.yaml templates/producer-deployment.yaml &lt;span style="color:#000;font-weight:bold"&gt;|&lt;/span&gt; wc -l&lt;span style="color:#204a87;font-weight:bold"&gt;)&lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;&lt;/span&gt;/2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/details&gt;
&lt;p&gt;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&gt;</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&gt;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&gt;
&lt;p&gt;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&gt;</description></item></channel></rss>