Skip to content

Commit

Permalink
Fix: Replace exit code if the job succeeds (#624)
Browse files Browse the repository at this point in the history
Co-authored-by: Yunus Olgun <[email protected]>
  • Loading branch information
yolgun and yolgun authored Feb 6, 2023
1 parent badcf95 commit 03cba24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/flinkcluster/flinkcluster_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ func (updater *ClusterStatusUpdater) deriveJobStatus(ctx context.Context) *v1bet
case oldJob.IsActive() && observedSubmitter.job != nil && observedSubmitter.job.Status.Active == 0:
if observedSubmitter.job.Status.Succeeded == 1 {
newJobState = v1beta1.JobStateSucceeded
if newJob.SubmitterExitCode == -1 {
log.Info("Job succeeded but the exit code is -1. This is an edge case that may " +
"happen if the controller is down or busy for a long time and the submitter pod is deleted externally " +
"including by kube-system:pod-garbage-collector. Changing exit code to 0.")
newJob.SubmitterExitCode = 0
}
} else if observedSubmitter.job.Status.Failed == 1 {
newJobState = v1beta1.JobStateFailed
} else {
Expand Down

0 comments on commit 03cba24

Please sign in to comment.