Skip to content

Commit db97a17

Browse files
Merge pull request #1023 from tkashem/bz-1744245
Bug 1744245: Subscription should not point to deleted ip
2 parents 2b6038f + 8432e24 commit db97a17

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/controller/operators/catalog/operator.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
extinf "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions"
2020
k8serrors "k8s.io/apimachinery/pkg/api/errors"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
"k8s.io/apimachinery/pkg/labels"
2322
"k8s.io/apimachinery/pkg/runtime/schema"
2423
utilclock "k8s.io/apimachinery/pkg/util/clock"
2524
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -915,7 +914,7 @@ func (o *Operator) ensureInstallPlan(logger *logrus.Entry, namespace string, sub
915914
}
916915

917916
// Check if any existing installplans are creating the same resources
918-
installPlans, err := o.lister.OperatorsV1alpha1().InstallPlanLister().InstallPlans(namespace).List(labels.Everything())
917+
installPlans, err := o.listInstallPlans(namespace)
919918
if err != nil {
920919
return nil, err
921920
}
@@ -1563,6 +1562,20 @@ func (o *Operator) listSubscriptions(namespace string) (subs []*v1alpha1.Subscri
15631562
return
15641563
}
15651564

1565+
func (o *Operator) listInstallPlans(namespace string) (ips []*v1alpha1.InstallPlan, err error) {
1566+
list, err := o.client.OperatorsV1alpha1().InstallPlans(namespace).List(metav1.ListOptions{})
1567+
if err != nil {
1568+
return
1569+
}
1570+
1571+
ips = make([]*v1alpha1.InstallPlan, 0)
1572+
for i := range list.Items {
1573+
ips = append(ips, &list.Items[i])
1574+
}
1575+
1576+
return
1577+
}
1578+
15661579
// competingCRDOwnersExist returns true if there exists a CSV that owns at least one of the given CSVs owned CRDs (that's not the given CSV)
15671580
func competingCRDOwnersExist(namespace string, csv *v1alpha1.ClusterServiceVersion, existingOwners map[string][]string) (bool, error) {
15681581
// Attempt to find a pre-existing owner in the namespace for any owned crd

0 commit comments

Comments
 (0)