Skip to content

Commit

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

Signed-off-by: kevinrizza <krizza@redhat.com>
Upstream-repository: operator-lifecycle-manager
Upstream-commit: 47aaa6be4a951c6bd8be016f6610c5319adc6a47
  • Loading branch information
kevinrizza authored and ci-robot committed Apr 18, 2024
1 parent 263ec26 commit 8aafc6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8aafc6c

Please sign in to comment.