Skip to content

Commit f6b4198

Browse files
committed
Remove OgSourceProvider
[2788](#2788) introduced the `OgSourceProvider` that allows for the exclusion of Catalogs in the global namespace. This `OgSourceProvider` was used by the resolver as the `SourceProvider` implementation. [3349](#3349) modified the resolver, to list the CatalogSources in the cluster by itself on the basis of the annotation in the `OperatorGroup` in the resolving namespace, so that that information can be passed to the `RegistrySourceProvider`, which now list the CatalogSources using a client instead of reaching out to the registry-server cache. This PR removes the `OgSourceProvider`, since the feature is now being directly implemented in the resolver, and the `OgSourceProvider` implementation has become redundant. Note that the feature parity is still maintained, as attested by the successful execution of [these tests](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/test/e2e/catalog_exclusion_test.go) introduced in 2788.
1 parent ff9084a commit f6b4198

File tree

2 files changed

+5
-88
lines changed

2 files changed

+5
-88
lines changed

pkg/controller/operators/catalog/og_source_provider.go

Lines changed: 0 additions & 82 deletions
This file was deleted.

pkg/controller/operators/catalog/operator.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ type Operator struct {
128128
bundleUnpackTimeout time.Duration
129129
clientFactory clients.Factory
130130
muInstallPlan sync.Mutex
131-
sourceInvalidator *resolver.RegistrySourceProvider
131+
resolverSourceProvider *resolver.RegistrySourceProvider
132132
}
133133

134134
type CatalogSourceSyncFunc func(logger *logrus.Entry, in *v1alpha1.CatalogSource) (out *v1alpha1.CatalogSource, continueSync bool, syncError error)
@@ -214,10 +214,9 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
214214
clientFactory: clients.NewFactory(validatingConfig),
215215
}
216216
op.sources = grpc.NewSourceStore(logger, 10*time.Second, 10*time.Minute, op.syncSourceState)
217-
op.sourceInvalidator = resolver.SourceProviderFromRegistryClientProvider(op.sources, lister.OperatorsV1alpha1().CatalogSourceLister(), logger)
218-
resolverSourceProvider := NewOperatorGroupToggleSourceProvider(op.sourceInvalidator, logger, op.lister.OperatorsV1().OperatorGroupLister())
217+
op.resolverSourceProvider = resolver.SourceProviderFromRegistryClientProvider(op.sources, lister.OperatorsV1alpha1().CatalogSourceLister(), logger)
219218
op.reconciler = reconciler.NewRegistryReconcilerFactory(lister, opClient, configmapRegistryImage, op.now, ssaClient, workloadUserID, opmImage, utilImage)
220-
res := resolver.NewOperatorStepResolver(lister, crClient, operatorNamespace, resolverSourceProvider, logger)
219+
res := resolver.NewOperatorStepResolver(lister, crClient, operatorNamespace, op.resolverSourceProvider, logger)
221220
op.resolver = resolver.NewInstrumentedResolver(res, metrics.RegisterDependencyResolutionSuccess, metrics.RegisterDependencyResolutionFailure)
222221

223222
// Wire OLM CR sharedIndexInformers
@@ -346,7 +345,7 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
346345
subscription.WithAppendedReconcilers(subscription.ReconcilerFromLegacySyncHandler(op.syncSubscriptions, nil)),
347346
subscription.WithRegistryReconcilerFactory(op.reconciler),
348347
subscription.WithGlobalCatalogNamespace(op.namespace),
349-
subscription.WithSourceProvider(op.sourceInvalidator),
348+
subscription.WithSourceProvider(op.resolverSourceProvider),
350349
)
351350
if err != nil {
352351
return nil, err
@@ -765,7 +764,7 @@ func (o *Operator) syncSourceState(state grpc.SourceState) {
765764

766765
switch state.State {
767766
case connectivity.Ready:
768-
o.sourceInvalidator.Invalidate(resolvercache.SourceKey(state.Key))
767+
o.resolverSourceProvider.Invalidate(resolvercache.SourceKey(state.Key))
769768
if o.namespace == state.Key.Namespace {
770769
namespaces, err := index.CatalogSubscriberNamespaces(o.catalogSubscriberIndexer,
771770
state.Key.Name, state.Key.Namespace)

0 commit comments

Comments
 (0)