Skip to content

Commit

Permalink
EVEREST-1182 fix install of everest operator
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
recharte committed Jun 27, 2024
1 parent 622ace2 commit fc287d5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,20 @@ func (k *Kubernetes) getTargetInstallPlanName(ctx context.Context, subscription
}
for _, ip := range ipList.Items {
for _, csv := range ip.Spec.ClusterServiceVersionNames {
if csv == targetCSV {
// If the CSV is the one we are looking for and the InstallPlan is
// waiting for approval, we return it.
// 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 https://github.com/operator-framework/kubectl-operator/issues/13
// for more details on a similar issue.
if csv == targetCSV && ip.Status.Phase == olmv1alpha1.InstallPlanPhaseRequiresApproval {
return ip.GetName(), nil
}
}
Expand Down

0 comments on commit fc287d5

Please sign in to comment.