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)
templates/jobs/migrate.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-migrate
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "10"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
...
templates/jobs/seed.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-seed
namespace: {{ .Release.Namespace }}
spec:
...
First job is updating the database structure.
Second job will reset the database contents and fill it with example data.
Since I did not add post-install hook to the seed job I was expecting that job to not run automatically but only when I manually ask it to run.
But it not only ran automatically, it tried to run before migrate.
How can I define a job that I have to manually trigger for it to run?
In vanilla kubernetes jobs run only when I explicitly execute their files using
kubectl apply -f job/seed-database.yaml
How can I do the same using helm?