<p>I created a new chart with 2 podPresets and 2 deployments and when I go to run helm install the deployment(pod) object is created first and then podPresets hence my values from podPreset are not applied to the pods, but when I manually create podPreset first and then deployment the presets are applied properly, Is there a way I can specify in helm as to which object should be created first.</p>

Nikhil Soni
<p>Posting this as Community Wiki for better visibility as answer was provided in comments below another answer made by @Rastko.</p>
<p><strong>Pod Presets</strong></p>
<blockquote>
<p>A Pod Preset is an API resource for injecting additional runtime
requirements into a Pod at creation time.  Using a Pod Preset allows
pod template authors to not have to explicitly provide all information
for every pod. This way, authors of pod templates consuming a specific
service do not need to know all the details about that service.</p>
</blockquote>
<p>For more information, please check <a href="https://kubernetes.io/docs/concepts/workloads/pods/podpreset/" rel="nofollow noreferrer">official docs</a>.</p>
<p><strong>Order of deploying objects in Helm</strong></p>
<p>Order of deploying is hardcoded in <code>Helm</code>. List can be found <a href="https://github.com/helm/helm/blob/9ad53aac42165a5fadc6c87be0dea6b115f93090/pkg/tiller/kind_sorter.go#L29" rel="nofollow noreferrer">here</a>.</p>
<p>In addition, if resource is not in the list it will be executed as last one.</p>
<p><strong>Answer to question from comments</strong>*</p>
<blockquote>
<p>Answer to your question - To achieve order different then default one, you can create two helm charts in which one with deployments is executed afterwards with <code>preinstall hook</code> making sure that presets are there.</p>
</blockquote>
<p><a href="https://helm.sh/docs/topics/charts_hooks/" rel="nofollow noreferrer">Pre-install hook</a> annotation allows to execute after templates are rendered, but before any resources are created.</p>
<p>This workaround was mentioned on <a href="https://github.com/helm/helm/issues/1228#issuecomment-249707316" rel="nofollow noreferrer">Github</a> thread. Example for service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: foo
  annotations:
    &quot;helm.sh/hook&quot;: &quot;pre-install&quot;
</code></pre>
<p>As additional information, there is possibility to define weight for a hook which will help build a deterministic executing order.</p>
<blockquote>
<pre><code>  annotations:
    &quot;helm.sh/hook-weight&quot;: &quot;5&quot;
</code></pre>
</blockquote>
<p>For more details regarding this annotation, please check this <a href="https://stackoverflow.com/a/50510838/11148139">Stackoverflow qustion</a>.</p>
