Skip to content

Commit d1b2c38

Browse files
committed
fix(catalog): use installplan lister instead of api client
1 parent 88ece34 commit d1b2c38

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

manifests/0000_50_11-catalog-operator.deployment.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ spec:
2727
args:
2828
- '-namespace'
2929
- openshift-operator-lifecycle-manager
30-
- '-debug'
3130
image: quay.io/coreos/olm@sha256:995a181839f301585a0e115c083619b6d73812c58a8444d7b13b8e407010325f
3231
imagePullPolicy: IfNotPresent
3332
ports:

pkg/controller/operators/catalog/operator.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func NewOperator(kubeconfigPath string, logger *logrus.Logger, wakeupInterval ti
9696
// resolver needs subscription and csv listers
9797
lister.OperatorsV1alpha1().RegisterSubscriptionLister(namespace, nsInformerFactory.Operators().V1alpha1().Subscriptions().Lister())
9898
lister.OperatorsV1alpha1().RegisterClusterServiceVersionLister(namespace, nsInformerFactory.Operators().V1alpha1().ClusterServiceVersions().Lister())
99+
lister.OperatorsV1alpha1().RegisterInstallPlanLister(namespace, nsInformerFactory.Operators().V1alpha1().InstallPlans().Lister())
99100
}
100101

101102
// Create a new queueinformer-based operator.
@@ -672,7 +673,7 @@ func (o *Operator) ensureSubscriptionInstallPlanState(logger *logrus.Entry, sub
672673

673674
// check if there's an installplan that created this subscription (only if it doesn't have a reference yet)
674675
// this indicates it was newly resolved by another operator, and we should reference that installplan in the status
675-
ips, err := o.client.OperatorsV1alpha1().InstallPlans(sub.GetNamespace()).List(metav1.ListOptions{})
676+
ips, err := o.lister.OperatorsV1alpha1().InstallPlanLister().InstallPlans(sub.GetNamespace()).List(labels.Everything())
676677
if err != nil {
677678
logger.WithError(err).Debug("couldn't get installplans")
678679
// if we can't list, just continue processing
@@ -681,12 +682,12 @@ func (o *Operator) ensureSubscriptionInstallPlanState(logger *logrus.Entry, sub
681682

682683
out := sub.DeepCopy()
683684

684-
for _, ip := range ips.Items {
685+
for _, ip := range ips {
685686
for _, step := range ip.Status.Plan {
686687
// TODO: is this enough? should we check equality of pkg/channel?
687688
if step != nil && step.Resource.Kind == v1alpha1.SubscriptionKind && step.Resource.Name == sub.GetName() {
688689
logger.WithField("installplan", ip.GetName()).Debug("found subscription in steps of existing installplan")
689-
out.Status.Install = o.referenceForInstallPlan(&ip)
690+
out.Status.Install = o.referenceForInstallPlan(ip)
690691
out.Status.State = v1alpha1.SubscriptionStateUpgradePending
691692
if updated, err := o.client.OperatorsV1alpha1().Subscriptions(sub.GetNamespace()).UpdateStatus(out); err != nil {
692693
return nil, err

0 commit comments

Comments
 (0)