Skip to content

Commit

Permalink
Update API to include new condition types
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Apr 14, 2023
1 parent 106751d commit edd944e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions pkg/controller/bundle/bundle_unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,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
Expand Down Expand Up @@ -422,7 +418,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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/bundle/bundle_unpacker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,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",
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ func (o *Operator) unpackBundles(plan *v1alpha1.InstallPlan) (bool, *v1alpha1.In
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
Expand Down Expand Up @@ -1734,7 +1734,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
}
}
Expand Down

0 comments on commit edd944e

Please sign in to comment.