Skip to content

Commit 62b5b72

Browse files
committed
retry on API call error
1 parent ec5be58 commit 62b5b72

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

controllers/osartifact_controller.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -407,22 +407,24 @@ func (r *OSArtifactReconciler) checkExport(ctx context.Context, artifact *osbuil
407407

408408
} else if job.Spec.Completions != nil {
409409
if job.Status.Succeeded > 0 && artifact.Status.Phase == osbuilder.Exporting {
410+
var apiErr error
410411
artifact.Status.Phase = osbuilder.Ready
411412
if err := r.upsertClusterIsoImage(ctx, artifact); err != nil {
412-
artifact.Status.Phase = osbuilder.Error
413+
artifact.Status.Phase = osbuilder.Exporting
413414
meta.SetStatusCondition(&artifact.Status.Conditions, metav1.Condition{
414415
Type: "Ready",
415416
Status: metav1.ConditionFalse,
416417
Reason: "Error",
417418
Message: consoleclient.GetErrorResponse(err, "CreateClusterIsoImage").Error(),
418419
})
420+
apiErr = err
419421
}
420422

421423
if err := TryToUpdateStatus(ctx, r.Client, artifact); err != nil {
422424
log.FromContext(ctx).Error(err, "failed to update artifact status")
423425
return ctrl.Result{}, err
424426
}
425-
return ctrl.Result{}, nil
427+
return ctrl.Result{}, apiErr
426428
} else if job.Status.Failed > 0 {
427429
artifact.Status.Phase = osbuilder.Error
428430
h := getBatchv1JobHealth(job)

0 commit comments

Comments
 (0)