@@ -40,6 +40,9 @@ func (csp *csvSourceProvider) Sources(namespaces ...string) map[cache.SourceKey]
4040 listSubscriptions : func (ctx context.Context ) (* v1alpha1.SubscriptionList , error ) {
4141 return csp .client .OperatorsV1alpha1 ().Subscriptions (namespace ).List (ctx , metav1.ListOptions {})
4242 },
43+ //getCSV: func(ctx context.Context, namespace string, name string) (*v1alpha1.ClusterServiceVersion, error) {
44+ // return csp.client.OperatorsV1alpha1().ClusterServiceVersions(namespace).Get(ctx, name, metav1.GetOptions{})
45+ //},
4346 }
4447 break // first ns is assumed to be the target ns, todo: make explicit
4548 }
@@ -54,6 +57,7 @@ type csvSource struct {
5457 logger logrus.StdLogger
5558
5659 listSubscriptions func (context.Context ) (* v1alpha1.SubscriptionList , error )
60+ // getCSV func(ctx context.Context, namespace string, name string) (*v1alpha1.ClusterServiceVersion, error)
5761}
5862
5963func (s * csvSource ) Snapshot (ctx context.Context ) (* cache.Snapshot , error ) {
@@ -93,19 +97,26 @@ func (s *csvSource) Snapshot(ctx context.Context) (*cache.Snapshot, error) {
9397 continue
9498 }
9599
96- if cachedSubscription , ok := csvSubscriptions [csv ]; ! ok || cachedSubscription == nil {
97- // we might be in an incoherent state, so let's check with live clients to make sure
98- realSubscriptions , err := s .listSubscriptions (ctx )
99- if err != nil {
100- return nil , fmt .Errorf ("failed to list subscriptions: %w" , err )
101- }
102- for _ , realSubscription := range realSubscriptions .Items {
103- if realSubscription .Status .InstalledCSV == csv .Name {
104- // oops, live cluster state is coherent
105- return nil , fmt .Errorf ("lister caches incoherent for CSV %s/%s - found owning Subscription %s/%s" , csv .Namespace , csv .Name , realSubscription .Namespace , realSubscription .Name )
106- }
107- }
108- }
100+ //if cachedSubscription, ok := csvSubscriptions[csv]; !ok || cachedSubscription == nil {
101+ // // we might be in an incoherent state, so let's check with live clients to make sure
102+ // realSubscriptions, err := s.listSubscriptions(ctx)
103+ // if err != nil {
104+ // return nil, fmt.Errorf("failed to list subscriptions: %w", err)
105+ // }
106+ // for _, realSubscription := range realSubscriptions.Items {
107+ // if realSubscription.Status.InstalledCSV == csv.Name {
108+ // // oops, live cluster state is coherent
109+ // return nil, fmt.Errorf("lister caches incoherent for CSV %s/%s - found owning Subscription %s/%s", csv.Namespace, csv.Name, realSubscription.Namespace, realSubscription.Name)
110+ // }
111+ // }
112+ // realCsv, err := s.getCSV(ctx, csv.Namespace, csv.Name)
113+ // if err != nil {
114+ // return nil, fmt.Errorf("lister caches might be incoherent for CSV %s/%s: %w", csv.Namespace, csv.Name, err)
115+ // }
116+ // if realCsv.GetUID() != csv.GetUID() {
117+ // return nil, fmt.Errorf("lister caches incoherent for CSV %s/%s: differing UIDs (%s != %s)", csv.Namespace, csv.Name, csv.UID)
118+ // }
119+ //}
109120
110121 if failForwardEnabled {
111122 replacementChainEndsInFailure , err := isReplacementChainThatEndsInFailure (csv , ReplacementMapping (csvs ))
0 commit comments