Skip to content

Commit 183a7f2

Browse files
authored
Remove OgSourceProvider (#3360)
[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 bb5a940 commit 183a7f2

File tree

2 files changed

+5
-88
lines changed

2 files changed

+5
-88
lines changed

pkg/controller/operators/catalog/og_source_provider.go

-82
This file was deleted.

pkg/controller/operators/catalog/operator.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ type Operator struct {
129129
bundleUnpackTimeout time.Duration
130130
clientFactory clients.Factory
131131
muInstallPlan sync.Mutex
132-
sourceInvalidator *resolver.RegistrySourceProvider
132+
resolverSourceProvider *resolver.RegistrySourceProvider
133133
}
134134

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

224223
// Wire OLM CR sharedIndexInformers
@@ -359,7 +358,7 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
359358
subscription.WithAppendedReconcilers(subscription.ReconcilerFromLegacySyncHandler(op.syncSubscriptions, nil)),
360359
subscription.WithRegistryReconcilerFactory(op.reconciler),
361360
subscription.WithGlobalCatalogNamespace(op.namespace),
362-
subscription.WithSourceProvider(op.sourceInvalidator),
361+
subscription.WithSourceProvider(op.resolverSourceProvider),
363362
)
364363
if err != nil {
365364
return nil, err
@@ -781,7 +780,7 @@ func (o *Operator) syncSourceState(state grpc.SourceState) {
781780

782781
switch state.State {
783782
case connectivity.Ready:
784-
o.sourceInvalidator.Invalidate(resolvercache.SourceKey(state.Key))
783+
o.resolverSourceProvider.Invalidate(resolvercache.SourceKey(state.Key))
785784
if o.namespace == state.Key.Namespace {
786785
namespaces, err := index.CatalogSubscriberNamespaces(o.catalogSubscriberIndexer,
787786
state.Key.Name, state.Key.Namespace)

0 commit comments

Comments
 (0)