Skip to content

Commit

Permalink
Fix unpack job cache issue (operator-framework#3204)
Browse files Browse the repository at this point in the history
In the same vein as
operator-framework#3202,
use update if the unpack job already exists but isn't cached

Signed-off-by: kevinrizza <krizza@redhat.com>
  • Loading branch information
kevinrizza committed Apr 17, 2024
1 parent a7b6658 commit 47aaa6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/controller/bundle/bundle_unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,9 @@ func (c *ConfigMapUnpacker) ensureJob(cmRef *corev1.ObjectReference, bundlePath
}
if len(jobs) == 0 {
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Create(context.TODO(), fresh, metav1.CreateOptions{})
if apierrors.IsAlreadyExists(err) {
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Update(context.TODO(), fresh, metav1.UpdateOptions{})
}
return
}

Expand All @@ -685,6 +688,9 @@ func (c *ConfigMapUnpacker) ensureJob(cmRef *corev1.ObjectReference, bundlePath
if time.Now().After(cond.LastTransitionTime.Time.Add(unpackRetryInterval)) {
fresh.SetName(names.SimpleNameGenerator.GenerateName(fresh.GetName()))
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Create(context.TODO(), fresh, metav1.CreateOptions{})
if apierrors.IsAlreadyExists(err) {
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Update(context.TODO(), fresh, metav1.UpdateOptions{})
}
}
}

Expand Down

0 comments on commit 47aaa6b

Please sign in to comment.