Skip to content

Commit

Permalink
Merge pull request #403 from afdesk/fix/status-for-v1-31
Browse files Browse the repository at this point in the history
fix: add new status conditions for k8s v1.31
  • Loading branch information
afdesk authored Oct 28, 2024
2 parents 8de56df + 5c50c8f commit b6099eb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/jobs/runnable_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ func (r *runnableJob) Run(ctx context.Context) error {
if r.job.UID != newJob.UID {
return
}
if len(newJob.Status.Conditions) == 0 {
return
}
switch condition := newJob.Status.Conditions[0]; condition.Type {
case batchv1.JobComplete:
complete <- nil
case batchv1.JobFailed:
complete <- fmt.Errorf("job failed: %s: %s", condition.Reason, condition.Message)
for _, condition := range newJob.Status.Conditions {
switch condition.Type {
case batchv1.JobComplete, batchv1.JobSuccessCriteriaMet:
complete <- nil
return
case batchv1.JobFailed:
complete <- fmt.Errorf("job failed: %s: %s", condition.Reason, condition.Message)
return
}
}
},
})
Expand Down

0 comments on commit b6099eb

Please sign in to comment.