From 8ca28d8b72ffaf2e30df7a558a002b3100f2a002 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Fri, 14 Apr 2023 14:40:28 +0100 Subject: [PATCH] Cleans up the TODO related to `BundleLookupFailed` Signed-off-by: Mikalai Radchuk --- pkg/controller/bundle/bundle_unpacker.go | 6 +----- pkg/controller/bundle/bundle_unpacker_test.go | 2 +- pkg/controller/operators/catalog/operator.go | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/controller/bundle/bundle_unpacker.go b/pkg/controller/bundle/bundle_unpacker.go index ffb607d8ce..28bd61fb28 100644 --- a/pkg/controller/bundle/bundle_unpacker.go +++ b/pkg/controller/bundle/bundle_unpacker.go @@ -34,10 +34,6 @@ import ( ) const ( - // TODO: Move to operator-framework/api/pkg/operators/v1alpha1 - // BundleLookupFailed describes conditions types for when BundleLookups fail - BundleLookupFailed operatorsv1alpha1.BundleLookupConditionType = "BundleLookupFailed" - // TODO: This can be a spec field // BundleUnpackTimeoutAnnotationKey allows setting a bundle unpack timeout per InstallPlan // and overrides the default specified by the --bundle-unpack-timeout flag @@ -426,7 +422,7 @@ func (c *ConfigMapUnpacker) UnpackBundle(lookup *operatorsv1alpha1.BundleLookup, result = newBundleUnpackResult(lookup) // if bundle lookup failed condition already present, then there is nothing more to do - failedCond := result.GetCondition(BundleLookupFailed) + failedCond := result.GetCondition(operatorsv1alpha1.BundleLookupFailed) if failedCond.Status == corev1.ConditionTrue { return result, nil } diff --git a/pkg/controller/bundle/bundle_unpacker_test.go b/pkg/controller/bundle/bundle_unpacker_test.go index b34fb69a24..a9a7c61a3f 100644 --- a/pkg/controller/bundle/bundle_unpacker_test.go +++ b/pkg/controller/bundle/bundle_unpacker_test.go @@ -1318,7 +1318,7 @@ func TestConfigMapUnpacker(t *testing.T) { LastTransitionTime: &start, }, { - Type: BundleLookupFailed, + Type: operatorsv1alpha1.BundleLookupFailed, Status: corev1.ConditionTrue, Reason: "DeadlineExceeded", Message: "Job was active longer than specified deadline", diff --git a/pkg/controller/operators/catalog/operator.go b/pkg/controller/operators/catalog/operator.go index 552fd0e5c6..6b0cde59b7 100644 --- a/pkg/controller/operators/catalog/operator.go +++ b/pkg/controller/operators/catalog/operator.go @@ -1423,7 +1423,7 @@ func (o *Operator) unpackBundles(plan *v1alpha1.InstallPlan, unpackTimeout time. out.Status.BundleLookups[i] = *res.BundleLookup // if the failed condition is present it means the bundle unpacking has failed - failedCondition := res.GetCondition(bundle.BundleLookupFailed) + failedCondition := res.GetCondition(v1alpha1.BundleLookupFailed) if failedCondition.Status == corev1.ConditionTrue { unpacked = false continue @@ -1726,7 +1726,7 @@ func (o *Operator) syncInstallPlans(obj interface{}) (syncError error) { func hasBundleLookupFailureCondition(plan *v1alpha1.InstallPlan) (bool, *v1alpha1.BundleLookupCondition) { for _, bundleLookup := range plan.Status.BundleLookups { for _, cond := range bundleLookup.Conditions { - if cond.Type == bundle.BundleLookupFailed && cond.Status == corev1.ConditionTrue { + if cond.Type == v1alpha1.BundleLookupFailed && cond.Status == corev1.ConditionTrue { return true, &cond } }