Skip to content

Commit 3c5ed1f

Browse files
kevinrizzaopenshift-cherrypick-robot
authored and
openshift-cherrypick-robot
committed
Fix unpack job cache issue (#3204)
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 <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: 47aaa6be4a951c6bd8be016f6610c5319adc6a47
1 parent f6374fb commit 3c5ed1f

File tree

2 files changed

+12
-0
lines changed
  • staging/operator-lifecycle-manager/pkg/controller/bundle
  • vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/bundle

2 files changed

+12
-0
lines changed

staging/operator-lifecycle-manager/pkg/controller/bundle/bundle_unpacker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,9 @@ func (c *ConfigMapUnpacker) ensureJob(cmRef *corev1.ObjectReference, bundlePath
668668
}
669669
if len(jobs) == 0 {
670670
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Create(context.TODO(), fresh, metav1.CreateOptions{})
671+
if apierrors.IsAlreadyExists(err) {
672+
job, err = c.client.BatchV1().Jobs(fresh.GetNamespace()).Update(context.TODO(), fresh, metav1.UpdateOptions{})
673+
}
671674
return
672675
}
673676

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

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/bundle/bundle_unpacker.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)