<p>I am trying to create a Helm chart (x) with 5 deployments within chart (x) in a specific order:</p>

<ol>
<li>Deployment 1 ( zk)</li>
<li>Deployment 2 (security)</li>
<li>Deployment 3 (localmaster)</li>
<li>Deployment 4 (nginx)</li>
<li>Deployment 5 (semoss)</li>
</ol>

<p>Helm/Tiller version: "v2.12.3"
Kubectl version: Major:"1", Minor:"17"
Minikube version: v1.6.2</p>

<p>What I currently have: 
RESOURCES:
==> v1/Deployment</p>

<p>NAME</p>

<ol>
<li>Localmaster</li>
<li>Nginx</li>
<li>Security</li>
<li>Semoss</li>
<li>Zk</li>
</ol>

<p>I can easily deploy chart (x) but once I run helm ls, my (x) chart is in a random order as you can see above. I only have one chart name (x) and within (x) I have:</p>

<p>Chart.yaml  <strong>charts</strong>  <strong>templates</strong>  values.yaml</p>

<p><strong>Templates</strong> and <strong>charts</strong> are directories and the rest are files.
 Is there a specific way or trick to have my x (chart) in the order I want? I’ve done some research and I am not so sure if helm spray in the right call as I am trying to deploy 1 chart with different deployment as opposed to an umbrella chart, and many other sub-charts.
Let me know if you need more info.</p>

<p><a href="https://helm.sh/docs/" rel="noreferrer">Helm</a> is package manager, allows you to define applications as a set of components on your cluster, and provides mechanisms to manage those sets from start to end. </p>

<p>Helm itself its not creating pods, it send requests to Kubernetes api and then Kubernetes is creating everything.</p>

<p>I have one idea how it can be achieve using Helm.</p>

<p>Helm order of deploying <code>Kinds</code> is hardcoded <a href="https://github.com/helm/helm/blob/9ad53aac42165a5fadc6c87be0dea6b115f93090/pkg/tiller/kind_sorter.go#L29" rel="noreferrer">here</a>. However if you want to set  deploying order of the same kind to k8s, it can be done using <code>annotations</code>.</p>

<p>You could set annotations: <a href="https://helm.sh/docs/topics/charts_hooks/#the-available-hooks" rel="noreferrer">Pre-install</a> hook with <code>hook-weight</code> like in <a href="https://helm.sh/docs/topics/charts_hooks/#writing-a-hook" rel="noreferrer">this</a> example (lower value in hook-weight have higher priority). Similar case can be found on <a href="https://github.com/helm/helm/issues/1228#issuecomment-249707316" rel="noreferrer">Github</a>.</p>

<p>It would look like example below:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    helm.sh/hook: pre-install
    helm.sh/hook-weight: "10"
  labels:
    app.kubernetes.io/instance: test
...
</code></pre>

<p>You can check which deployment was created first using <code>kubectl get events</code>. However, creation of pods is still scheduled by Kubernetes.</p>

<p>To obtain exactly what you need you can use <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="noreferrer">initContainers</a> and <code>hardcode</code> "sleep" command.<br> First deployment with sleep 1s, second deployment with 5s, third with 10s, depends how long deployment need to create all pods.</p>

<p>You can check <a href="https://www.alibabacloud.com/blog/helm-charts-and-templates-hooks-and-tests-part-3_595650" rel="noreferrer">this</a> article, but keep in mind <code>spec.containers</code> and <code>spec.initContainers</code> are two different things.</p>
