Skip to content

Commit a06d7d7

Browse files
ankitathomastmshort
authored andcommitted
retry unpacking jobs on failure
Signed-off-by: Ankita Thomas <[email protected]>
1 parent fa51d6f commit a06d7d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/controller/bundle/bundle_unpacker.go

+8
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,14 @@ func (c *ConfigMapUnpacker) ensureJob(cmRef *corev1.ObjectReference, bundlePath
659659

660660
return
661661
}
662+
// Cleanup old unpacking job and retry
663+
if _, isFailed := getCondition(job, batchv1.JobFailed); isFailed {
664+
err = c.client.BatchV1().Jobs(job.GetNamespace()).Delete(context.TODO(), job.GetName(), metav1.DeleteOptions{})
665+
if err == nil {
666+
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Create(context.TODO(), fresh, metav1.CreateOptions{})
667+
}
668+
return
669+
}
662670

663671
if equality.Semantic.DeepDerivative(fresh.GetOwnerReferences(), job.GetOwnerReferences()) && equality.Semantic.DeepDerivative(fresh.Spec, job.Spec) {
664672
return

0 commit comments

Comments
 (0)