Skip to content

Commit bb77142

Browse files
committed
Fix interrupt state to account for failure correctly
If the job hasn't completely failed but some of the pods have failed and we deleted the job we weren't setting the MOSB to interrupted as expected. This was because we had a wrong check for failure state. This patch fixes that. Signed-off-by: Urvashi <[email protected]>
1 parent a09f116 commit bb77142

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/controller/build/imagebuilder/jobimagebuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (j *jobImageBuilder) validateBuilderType(builder buildrequest.Builder) erro
329329
func MapJobStatusToBuildStatus(job *batchv1.Job) (mcfgv1.BuildProgress, []metav1.Condition) {
330330
// If the job is being deleted and it was not in either a successful or failed state
331331
// then the MachineOSBuild should be considered "interrupted"
332-
if job.DeletionTimestamp != nil && job.Status.Succeeded == 0 && job.Status.Failed == 0 {
332+
if job.DeletionTimestamp != nil && job.Status.Succeeded == 0 && job.Status.Failed < constants.JobMaxRetries+1 {
333333
return mcfgv1.MachineOSBuildInterrupted, apihelpers.MachineOSBuildInterruptedConditions()
334334
}
335335

0 commit comments

Comments
 (0)