<p>I have a deployment .yaml file that basically create a pod with mariadb, as follows</p>

<pre><code>    apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-pod
spec:
  replicas: 1
  selector:
    matchLabels:
      pod: {{ .Release.Name }}-pod
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        pod: {{ .Release.Name }}-pod
    spec:
      containers:
      - env:
        - name: MYSQL_ROOT_PASSWORD
          value: {{ .Values.db.password }}
        image: {{ .Values.image.repository }}
        name: {{ .Release.Name }}
        ports:
        - containerPort: 3306
        resources: 
          requests:
            memory: 2048Mi
            cpu: 0.5
          limits:
            memory: 4096Mi
            cpu: 1
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: dbsvr-claim
        - mountPath: /etc/mysql/conf.d/my.cnf
          name: conf
          subPath: my.cnf
        - mountPath: /docker-entrypoint-initdb.d/init.sql
          name: conf
          subPath: init.sql

      restartPolicy: Always

      volumes:
      - name: dbsvr-claim
        persistentVolumeClaim:
          claimName: {{ .Release.Name }}-claim
      - name: conf
        configMap:
          name: {{ .Release.Name }}-configmap
status: {}
</code></pre>

<p>Upon success on </p>

<pre><code>helm install abc ./abc/ -f values.yaml
</code></pre>

<p>I have a job that generates a mysqldump backup file and it completes successfully (just showing the relevant code)</p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata: 
    name: {{ .Release.Name }}-job
spec:
  template:
    metadata:
      name: {{ .Release.Name }}-job
    spec:
        containers:
        - name: {{ .Release.Name }}-dbload
          image: {{ .Values.image.repositoryRoot }}/{{.Values.image.imageName}}
          command: ["/bin/sh", "-c"]
          args: 
            - mysqldump -p$(PWD) -h{{.Values.db.source}} -u$(USER) --databases xyz &gt; $(FILE);
              echo "done!";
          imagePullPolicy: Always
        # Do not restart containers after they exit
        restartPolicy: Never    

</code></pre>

<p>So, here's my question. Is there a way to automatically start the job after the helm install abc ./ -f values.yaml finishes with success?</p>

Ricardo Adão
<p>you can use <code>kubectl wait -h</code> command to execute job when the <code>condition=Ready</code> for the deployment.</p>

<p>Here the article <a href="https://hackernoon.com/kubectl-tip-of-the-day-wait-like-a-boss-40a818c423ac" rel="nofollow noreferrer">wait-for-condition</a> demonstrate quite similar situation</p>
