Skip to content

Commit

Permalink
Remove OgSourceProvider (#3360)
Browse files Browse the repository at this point in the history
[2788](operator-framework/operator-lifecycle-manager#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](operator-framework/operator-lifecycle-manager#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.

Upstream-repository: operator-lifecycle-manager
Upstream-commit: 183a7f24c1cbb9a94e7c612ab62689519c001f7f
  • Loading branch information
anik120 authored and ci-robot committed Sep 13, 2024
1 parent c54097d commit 326c50a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 176 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,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 @@ -215,10 +215,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 @@ -359,7 +358,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 @@ -781,7 +780,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

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 326c50a

Please sign in to comment.