Skip to content

Commit

Permalink
Remove OgSourceProvider
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
anik120 committed Aug 8, 2024
1 parent ff9084a commit f6b4198
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 88 deletions.
82 changes: 0 additions & 82 deletions pkg/controller/operators/catalog/og_source_provider.go

This file was deleted.

11 changes: 5 additions & 6 deletions pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type Operator struct {
bundleUnpackTimeout time.Duration
clientFactory clients.Factory
muInstallPlan sync.Mutex
sourceInvalidator *resolver.RegistrySourceProvider
resolverSourceProvider *resolver.RegistrySourceProvider
}

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

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

switch state.State {
case connectivity.Ready:
o.sourceInvalidator.Invalidate(resolvercache.SourceKey(state.Key))
o.resolverSourceProvider.Invalidate(resolvercache.SourceKey(state.Key))
if o.namespace == state.Key.Namespace {
namespaces, err := index.CatalogSubscriberNamespaces(o.catalogSubscriberIndexer,
state.Key.Name, state.Key.Namespace)
Expand Down

0 comments on commit f6b4198

Please sign in to comment.