Try to improve error message for setup job failure
@@ -162,6 +162,12 @@ func isSetupJobComplete(job *batchv1.Job) corev1.ConditionStatus {
func isSetupJobFailed(job *batchv1.Job) (bool, string) {
for _, c := range job.Status.Conditions {
if c.Type == batchv1.JobFailed && c.Status == corev1.ConditionTrue {
+ switch c.Reason {
+ case "BackoffLimitExceeded":
+ // If we hit the backoff limit it means that at least one container is exiting with 1
+ return true, "Setup job did not complete successfully"
+ default:
+ // Use the condition to construct a message
m := c.Message
if m == "" && c.Reason != "" {
m = fmt.Sprintf("Setup job failed with reason '%s'", c.Reason)
@@ -172,6 +178,7 @@ func isSetupJobFailed(job *batchv1.Job) (bool, string) {
return true, m
}
}
+ }
// For versions of Kube that do not report failures as conditions, just look for failed pods
if job.Status.Failed > 0 {
