<p>I am trying to make a Kubernetes deployment script using helm.
I created following 2 jobs (skipped the container template since I guess it does not matter)</p>
<p>templates/jobs/migrate.yaml</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: {{ .Release.Name }}-migrate
  namespace: {{ .Release.Namespace }}
  annotations:
    &quot;helm.sh/hook&quot;: post-install
    &quot;helm.sh/hook-weight&quot;: &quot;10&quot;
    &quot;helm.sh/hook-delete-policy&quot;: hook-succeeded
spec:
  ...
</code></pre>
<p>templates/jobs/seed.yaml</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: {{ .Release.Name }}-seed
  namespace: {{ .Release.Namespace }}
spec:
  ...
</code></pre>
<p>First job is updating the database structure.<br />
Second job will reset the database contents and fill it with example data.</p>
<p>Since I did not add <code>post-install</code> hook to the seed job I was expecting that job to not run automatically but only when I manually ask it to run.<br />
But it not only ran automatically, it tried to run before migrate.</p>
<p>How can I define a job that I have to manually trigger for it to run?<br />
In vanilla kubernetes jobs run only when I explicitly execute their files using<br />
<code>kubectl apply -f job/seed-database.yaml</code></p>
<p>How can I do the same using helm?</p>

HubertNNN
<p>Replying to your last comment and thanks to @HubertNNN for his idea:</p>
<blockquote>
<p>Can I run a suspended job multiple times? From documentation it seems
like a one time job that cannot be rerun like normal jobs</p>
</blockquote>
<p>It's normal job, you just editing yaml file with the <code>.spec.suspend: true</code> and it's <code>startTime</code>:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: myjob
spec:
  suspend: true
  parallelism: 1
  completions: 5
  template:
    spec:
      ...
</code></pre>
<blockquote>
<p>If all Jobs were created in the suspended state and placed in a pending queue, I can achieve priority-based Job scheduling by resuming Jobs in the right order.</p>
</blockquote>
<p>More information is <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#suspending-a-job" rel="nofollow noreferrer">here</a></p>
