Skip to content

Commit fc287d5

Browse files
committed
EVEREST-1182 fix install of everest operator
We introduced this phase check because OLM has a bug where it sometimes creates duplicate InstallPlans for the same CSV and we found a few cases where the duplicate InstallPlan wasn't reconciled correctly and abandoned by OLM. This abandoned InstallPlan was missing the status field meaning it was also missing the necessary plan to install the operator. Approving this InstallPlan would cause the operator to never be installed. By checking the phase we make sure we will be approving an InstallPlan that is actually ready to be approved. See operator-framework/kubectl-operator#13 for more details on a similar issue.
1 parent 622ace2 commit fc287d5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/kubernetes/kubernetes.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,20 @@ func (k *Kubernetes) getTargetInstallPlanName(ctx context.Context, subscription
586586
}
587587
for _, ip := range ipList.Items {
588588
for _, csv := range ip.Spec.ClusterServiceVersionNames {
589-
if csv == targetCSV {
589+
// If the CSV is the one we are looking for and the InstallPlan is
590+
// waiting for approval, we return it.
591+
// We introduced this phase check because OLM has a bug where it
592+
// sometimes creates duplicate InstallPlans for the same CSV and we
593+
// found a few cases where the duplicate InstallPlan wasn't
594+
// reconciled correctly and abandoned by OLM. This abandoned
595+
// InstallPlan was missing the status field meaning it was also
596+
// missing the necessary plan to install the operator. Approving
597+
// this InstallPlan would cause the operator to never be installed.
598+
// By checking the phase we make sure we will be approving an
599+
// InstallPlan that is actually ready to be approved.
600+
// See https://github.com/operator-framework/kubectl-operator/issues/13
601+
// for more details on a similar issue.
602+
if csv == targetCSV && ip.Status.Phase == olmv1alpha1.InstallPlanPhaseRequiresApproval {
590603
return ip.GetName(), nil
591604
}
592605
}

0 commit comments

Comments
 (0)