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
if con.Type == v1.JobComplete && con.Status == corev1.ConditionTrue && job.Status.Succeeded > 0 {
fmt.Printf("Job: %v Completed Successfully: %v
", name, con)
break
} else if con.Type == v1.JobFailed && con.Status == corev1.ConditionTrue {
if job.Status.Active == 0 && job.Status.Succeeded == 0 {
fmt.Printf("Job: %v Failed: %v
", name, con)
break
}
}
This is how I am checking now, I am not completely sure this is correct