title: How do I make Helm chart Hooks post-install work if other charts are in running state
body: <p>I have a couple of helm charts in a <code>myapp/templates/</code> directory, and they deploy as expected with <code>helm install myapp</code>.</p>
  <p>These two templates are for example:</p>
  <ul>
  <li>database.yaml</li>
  <li>cronjob.yaml</li>
  </ul>
  <p>I'd like for the <code>cronjob.yaml</code> to only run after the <code>database.yaml</code> is in a running state.  I currently have an issue where <code>database.yaml</code> fairly regularly fails in a way we half expect (it's not ideal, but it is what it is).</p>
  <p>I've found hooks, but I think I'm either using them incorrectly, or they don't determine whether the pod is in Running, Pending, some state of crashed, etc...</p>
  <p>There are no changes I've made to database.yaml in order to use hooks, but my cronjob.yaml which I only want to run if database.yaml is in a running state, I added the annotations as follows:</p>
  <p><strong>cronjob.yaml</strong></p>
  <pre><code>apiVersion: batch/v1beta1
  kind: CronJob
  metadata:
    name: database
    annotations:
      &quot;helm.sh/hook&quot;: &quot;post-install&quot;
    labels:
      app: database
      service: database
  spec:
    schedule: &quot;* * * * *&quot;
    successfulJobsHistoryLimit: 1
    failedJobsHistoryLimit: 1
    jobTemplate:
      spec:
        template:
          spec:
            containers:
              - name: customtask
                image: &quot;{{ .Values.myimage }}&quot;
                command:
                  - /bin/sh
                  - -c
                  - supercooltask.sh
            restartPolicy: Never
  </code></pre>
  <p>How can I change this hook configuration to allow <code>cronjob.yaml</code> to only run if <code>database.yaml</code> deploys and runs successfully?</p>