@@ -40,6 +40,9 @@ func (csp *csvSourceProvider) Sources(namespaces ...string) map[cache.SourceKey]
40
40
listSubscriptions : func (ctx context.Context ) (* v1alpha1.SubscriptionList , error ) {
41
41
return csp .client .OperatorsV1alpha1 ().Subscriptions (namespace ).List (ctx , metav1.ListOptions {})
42
42
},
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
+ //},
43
46
}
44
47
break // first ns is assumed to be the target ns, todo: make explicit
45
48
}
@@ -54,6 +57,7 @@ type csvSource struct {
54
57
logger logrus.StdLogger
55
58
56
59
listSubscriptions func (context.Context ) (* v1alpha1.SubscriptionList , error )
60
+ // getCSV func(ctx context.Context, namespace string, name string) (*v1alpha1.ClusterServiceVersion, error)
57
61
}
58
62
59
63
func (s * csvSource ) Snapshot (ctx context.Context ) (* cache.Snapshot , error ) {
@@ -93,19 +97,26 @@ func (s *csvSource) Snapshot(ctx context.Context) (*cache.Snapshot, error) {
93
97
continue
94
98
}
95
99
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
+ //}
109
120
110
121
if failForwardEnabled {
111
122
replacementChainEndsInFailure , err := isReplacementChainThatEndsInFailure (csv , ReplacementMapping (csvs ))
0 commit comments