Skip to content

Commit

Permalink
fix: handle event job as nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Lüders committed Feb 8, 2024
1 parent 21b8348 commit 8cbe5b0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/periodic/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ func (j *JobController) WaitForJobCompletion(ctx context.Context, job *batchv1.J
if event.Type == watch.Error {
return fmt.Errorf("watcher received error event: %v", event.Object)
}

job := event.Object.(*batchv1.Job)
if job == nil {
return fmt.Errorf("cannot cast event objeto into job: %v", event.Object)
}
if job.Status.Succeeded > 0 {
return nil
}
Expand Down

0 comments on commit 8cbe5b0

Please sign in to comment.