Skip to content

Commit

Permalink
fix(catalog): re-install resources in existing installplan
Browse files Browse the repository at this point in the history
This specifically fixes the scenario where a subscription is deleted and
recreated in a namespace with an additional subscription. When the
subscription of interest is deleted, the associated installplan remains
due to the other subscription's owner reference. Because the existing
installplan manifests match, no additional work is done. This is a
problem if resources that were originally installed have been deleted.

Now after a subscription is recreated, the proper owner references are
re-added onto the install plan as well as all the resources are checked
that they are installed.
  • Loading branch information
jpeeler committed Jul 24, 2019
1 parent d1be59c commit e67d450
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,21 @@ func (o *Operator) ensureInstallPlan(logger *logrus.Entry, namespace string, sub
for _, installPlan := range installPlans {
if installPlan.Status.CSVManifestsMatch(steps) {
logger.Infof("found InstallPlan with matching manifests: %s", installPlan.GetName())
return reference.GetReference(installPlan)

for _, sub := range subs {
ownerutil.EnsureOwner(installPlan, sub)
}
updatedPlan, err := o.client.OperatorsV1alpha1().InstallPlans(installPlan.GetNamespace()).Update(installPlan)

updatedPlan.Status.Phase = v1alpha1.InstallPlanPhaseInstalling
for _, step := range updatedPlan.Status.Plan {
step.Status = v1alpha1.StepStatusUnknown
}
_, err = o.client.OperatorsV1alpha1().InstallPlans(namespace).UpdateStatus(updatedPlan)
if err != nil {
return nil, err
}
return reference.GetReference(updatedPlan)
}
}
logger.Warn("no installplan found with matching manifests, creating new one")
Expand Down

0 comments on commit e67d450

Please sign in to comment.