@@ -131,6 +131,7 @@ type Operator struct {
131
131
clientFactory clients.Factory
132
132
muInstallPlan sync.Mutex
133
133
resolverSourceProvider * resolver.RegistrySourceProvider
134
+ operatorCacheProvider resolvercache.OperatorCacheProvider
134
135
}
135
136
136
137
type CatalogSourceSyncFunc func (logger * logrus.Entry , in * v1alpha1.CatalogSource ) (out * v1alpha1.CatalogSource , continueSync bool , syncError error )
@@ -217,8 +218,9 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
217
218
}
218
219
op .sources = grpc .NewSourceStore (logger , 10 * time .Second , 10 * time .Minute , op .syncSourceState )
219
220
op .resolverSourceProvider = resolver .SourceProviderFromRegistryClientProvider (op .sources , lister .OperatorsV1alpha1 ().CatalogSourceLister (), logger )
221
+ op .operatorCacheProvider = resolver .NewOperatorCacheProvider (lister , crClient , op .resolverSourceProvider , logger )
220
222
op .reconciler = reconciler .NewRegistryReconcilerFactory (lister , opClient , configmapRegistryImage , op .now , ssaClient , workloadUserID , opmImage , utilImage )
221
- res := resolver .NewOperatorStepResolver (lister , crClient , operatorNamespace , op .resolverSourceProvider , logger )
223
+ res := resolver .NewOperatorStepResolver (lister , crClient , operatorNamespace , op .operatorCacheProvider , logger )
222
224
op .resolver = resolver .NewInstrumentedResolver (res , metrics .RegisterDependencyResolutionSuccess , metrics .RegisterDependencyResolutionFailure )
223
225
224
226
// Wire OLM CR sharedIndexInformers
@@ -360,7 +362,7 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
360
362
subscription .WithAppendedReconcilers (subscription .ReconcilerFromLegacySyncHandler (op .syncSubscriptions )),
361
363
subscription .WithRegistryReconcilerFactory (op .reconciler ),
362
364
subscription .WithGlobalCatalogNamespace (op .namespace ),
363
- subscription .WithSourceProvider (op .resolverSourceProvider ),
365
+ subscription .WithOperatorCacheProvider (op .operatorCacheProvider ),
364
366
)
365
367
if err != nil {
366
368
return nil , err
@@ -781,6 +783,7 @@ func (o *Operator) syncSourceState(state grpc.SourceState) {
781
783
782
784
o .logger .Infof ("state.Key.Namespace=%s state.Key.Name=%s state.State=%s" , state .Key .Namespace , state .Key .Name , state .State .String ())
783
785
metrics .RegisterCatalogSourceState (state .Key .Name , state .Key .Namespace , state .State )
786
+ metrics .RegisterCatalogSourceSnapshotsTotal (state .Key .Name , state .Key .Namespace )
784
787
785
788
switch state .State {
786
789
case connectivity .Ready :
@@ -896,6 +899,7 @@ func (o *Operator) handleCatSrcDeletion(obj interface{}) {
896
899
o .logger .WithField ("source" , sourceKey ).Info ("removed client for deleted catalogsource" )
897
900
898
901
metrics .DeleteCatalogSourceStateMetric (catsrc .GetName (), catsrc .GetNamespace ())
902
+ metrics .DeleteCatalogSourceSnapshotsTotal (catsrc .GetName (), catsrc .GetNamespace ())
899
903
}
900
904
901
905
func validateSourceType (logger * logrus.Entry , in * v1alpha1.CatalogSource ) (out * v1alpha1.CatalogSource , continueSync bool , _ error ) {
0 commit comments