<p>We have below chart structure in helm which can deploy 'a microservice' to our k8s cluster</p>
<pre><code>service-chart
|_templates
  |_deployment.yaml
  |_Ingress.yaml
  |_service.yaml
|_Chart.yaml
|_valueBase.yaml
|_valueForService1.yaml
|_valueForService2.yaml
..
..
|_valueForService{n}.yaml

</code></pre>
<p><code>valueBase.yaml</code> contains default values for a service (for eg. limits, replicas etc)</p>
<pre><code>global:
 namespace: teamname
 environment: staging
limits:
 memory: &quot;500Mi&quot;
 cpu: &quot;300m&quot;
deployments:
 replicas: 1
probes:
 path: &quot;/&quot;
</code></pre>
<p>and <code>valueForService1.yaml</code> file contains values overridden for a specific service</p>
<pre><code>app: 
 name: &quot;service1&quot;
image:
 name: &quot;service1&quot;
 version: &quot;2021.11.xxx&quot;
port: 50001
deployments: 
 replicas: 3

</code></pre>
<p>All of above services follow exactly same structure and create similar resources i.e. a service, a pod and an ingress.
we deploy an individual service as</p>
<pre><code>helm upgrade --install -f valueBase.yaml -f valueForService1.yaml service1 .
</code></pre>
<p>But problem is we have 50 of these services.
and we would want to install all of them together instead of running 50 commands back to back.
Also would like to have some release co-ordination in between releasing multiple services.
for eg. release service1 before releasing service2.</p>
<p>I know we can do this in one command with 50 <code>-f</code> parameters in it but that's not the kind of solution I am here for.</p>
<p>How can we package them properly so we can</p>
<ul>
<li>release all services at once when we want to.</li>
<li>release an individual service</li>
<li>release them as group of service for eg. group1 consist of service1, service2 and service3</li>
<li>release orchestration for eg. release service1 then service2 then service3</li>
</ul>
<p>All suggestions welcomed. Feel free to ask for more details.</p>
<p>Note: We tried using sub-chart but it doesn't appear to be solved by using sub-charts.
We just have lots of services with similar structure.
but I might have used sub charts completely wrong.</p>

<p>What you're looking for is <a href="https://github.com/roboll/helmfile" rel="nofollow noreferrer"><code>helmfile</code></a></p>
<ol>
<li><p>Store your base chart and services values in the same folder.</p>
</li>
<li><p>Create <code>helmfile.yml</code>.</p>
<pre><code>releases:
  - name: service1
    labels:
      app: service1
      group: group1
    chart: charts/baseChart
    values:
      - valueBase.yaml
      - valueForService1.yaml
      - fullnameOverride: service1
  - name: service2
    labels:
      app: service2
      group: group1
    chart: charts/baseChart
    values:
      - valueBase.yaml
      - valueForService2.yaml
      - fullnameOverride: service2
    needs:
      - service1
</code></pre>
<p>Each release in the <em><strong>releases</strong></em> list is a helm release definition. You can control installation order with the <a href="https://github.com/roboll/helmfile/tree/v0.142.0#dag-aware-installationdeletion-ordering-with-needs" rel="nofollow noreferrer"><code>needs</code></a> keyword.</p>
</li>
<li><p>Now your folder looks something like this</p>
<pre><code>.
├── charts/
│   └── baseChart/
├── helmfile.yml
├── valueBase.yml
├── valueForService1.yml
└── valueForService2.yml
</code></pre>
<p>and you're ready to run helmfile commands</p>
</li>
</ol>
<ul>
<li><p><code>helmfile -n &lt;namespace&gt; apply</code> will release all services at once</p>
</li>
<li><p><code>helmfile -n &lt;namespace&gt; -l app=service1 apply</code> will release an individual service with the <em><strong>app: service</strong></em> label</p>
</li>
<li><p><code>helmfile -n &lt;namespace&gt; -l group=group1 apply</code> will release all services with the <em><strong>group: group1</strong></em> label</p>
</li>
</ul>
