Skip to content

Commit 79c11b9

Browse files
committed
fix: check for unsat resolutions in Reconcile
Signed-off-by: Joe Lanford <[email protected]>
1 parent fd7cfb5 commit 79c11b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/controllers/operator_controller.go

+16
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ package controllers
1818

1919
import (
2020
"context"
21+
"errors"
2122
"fmt"
2223

2324
"github.com/go-logr/logr"
2425
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
26+
"github.com/operator-framework/deppy/pkg/deppy"
2527
"github.com/operator-framework/deppy/pkg/deppy/solver"
2628
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
2729
"k8s.io/apimachinery/pkg/api/equality"
@@ -136,6 +138,20 @@ func (r *OperatorReconciler) reconcile(ctx context.Context, op *operatorsv1alpha
136138
return ctrl.Result{}, err
137139
}
138140

141+
// TODO: Checking for unsat is awkward using the current version of deppy.
142+
// This awkwardness has been fixed in an unreleased version of deppy.
143+
// When there is a new minor release of deppy, we can revisit this and
144+
// simplify this to a normal error check.
145+
// See https://github.com/operator-framework/deppy/issues/139.
146+
unsat := deppy.NotSatisfiable{}
147+
if ok := errors.As(solution.Error(), &unsat); ok && len(unsat) > 0 {
148+
op.Status.InstalledBundleResource = ""
149+
setInstalledStatusConditionUnknown(&op.Status.Conditions, "installation has not been attempted as resolution is unsatisfiable", op.GetGeneration())
150+
op.Status.ResolvedBundleResource = ""
151+
setResolvedStatusConditionFailed(&op.Status.Conditions, unsat.Error(), op.GetGeneration())
152+
return ctrl.Result{}, err
153+
}
154+
139155
// lookup the bundle entity in the solution that corresponds to the
140156
// Operator's desired package name.
141157
bundleEntity, err := r.getBundleEntityFromSolution(solution, op.Spec.PackageName)

0 commit comments

Comments
 (0)