title: Automating wildcard subdomain support for Kubernetes using Helm operator
body: <p>Here is my use case:
  We have a customer, where each of their services has to be available on dedicated subdomain. Naming convention should be <code>service-name.customerdomain.com</code>, where <code>service-name</code> is the deployed service and <code>customerdomain.com</code> is the customer domain. When a new service is created, it should be available <strong>automatically</strong>, i.e. once <code>service-name</code> service is deployed into the cluster, it has to be available on <code>service-name.customerdomain.com</code>.</p>
  
  <p>I know, this can be achieved <strong>manually</strong> by following steps:</p>
  
  <ol>
  <li><p>Add Ingress controller to the cluster </p></li>
  <li><p>Create wildcard DNS <code>*.customerdomain.com</code> and point it to the
  Ingress controller</p></li>
  <li>Map subdomain for each running service. For every existing service from the cluster create a separate section into Ingress resource file <code>ingress.yaml</code>, e.g.</li>
  </ol>
  
  <blockquote>
  <pre><code>Spec:     
      rules: 
      - host: helloworld.awesome-customer.com 
      http: 
          paths: 
          - path: /* 
          backend: 
              serviceName: helloworld 
              servicePort: 8080 
      - host: nextfineapp.awesome-customer.com 
      http: 
          paths: 
          - path: /* 
          backend: 
              serviceName: nextfineapp 
              servicePort: 8080 
      - [...]
  </code></pre>
  </blockquote>
  
  <ol start="4">
  <li>Add Ingress resource file new <code>-host</code> section for each newly
  deployed service</li>
  <li>Remove Ingress resource file <code>-host</code> section for each removed
  service</li>
  </ol>
  
  <p>Basically - I would like to automate steps 4 &amp; 5. I am aware Ingress cannot handle this by itself, however, googling around, it appears that updating <code>ingress.yaml</code> file each time a new service is deployed / an existing one is removed can be achieved via <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a> and its values files.</p>
  
  <p>I would appreciate if a sample solution can be pointed out / described below.</p>