<p>There are lot of fields out there in the library but it basically talks about job finished or not, but how to check if a job is finished and successful or job is finished and failure</p>

<pre><code>if con.Type == v1.JobComplete &amp;&amp; con.Status == corev1.ConditionTrue &amp;&amp; job.Status.Succeeded &gt; 0 {
    fmt.Printf("Job: %v Completed Successfully: %v\n", name, con)
    break
} else if con.Type == v1.JobFailed &amp;&amp; con.Status == corev1.ConditionTrue {
    if job.Status.Active == 0 &amp;&amp; job.Status.Succeeded == 0 {
        fmt.Printf("Job: %v Failed: %v\n", name, con)
        break
    }
}
</code></pre>

<p>This is how I am checking now, I am not completely sure this is correct</p>

Coding Ninja
<p>Similar to <code>Bharath</code>s answer except it handles the race condition where this function is called after the job is created but before the job pod is active.</p>
<pre><code>func getJobStatus(jobName string) error {
    // k8sClient := initialize k8s client

    job, err := k8sClient.BatchV1().Jobs(h.namespace).Get(jobName, metav1.GetOptions{})
    if err != nil {
        return err
    }

    if job.Status.Active == 0 &amp;&amp; job.Status.Succeeded == 0 &amp;&amp; job.Status.Failed == 0 {
        return fmt.Errorf(&quot;%s hasn't started yet&quot;, job.Name)
    }

    if job.Status.Active &gt; 0 {
        return fmt.Errorf(&quot;%s is still running&quot;, job.Name)
    }

    if job.Status.Succeeded &gt; 0 {
        return nil // Job ran successfully
    }

    return fmt.Errorf(&quot;%s has failed with error&quot;, job.Name)
}
</code></pre>
