@@ -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 ) {
@@ -105,6 +109,13 @@ func (s *csvSource) Snapshot(ctx context.Context) (*cache.Snapshot, error) {
105
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 )
106
110
}
107
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" , csv .Namespace , csv .Name )
118
+ }
108
119
}
109
120
110
121
if failForwardEnabled {
0 commit comments