Skip to content

Commit

Permalink
Reduce resolver dependencies on operator-registry and operator-lifecy…
Browse files Browse the repository at this point in the history
…cle-manager. (#2337)

* Remove resolver dependency on registry.CatalogKey.

Signed-off-by: Ben Luddy <bluddy@redhat.com>

* Remove hard resolver dependency on the gRPC registry client.

The most significant change is the introduction of a new Source
interface, which represents a single source of cache entries. In the
existing implementation, the cache was hardcoded to fetch content from
the operator-registry gRPC API on misses. This was a barrier to
off-cluster tools and other applications that should be able to
perform resolution without running a registry server.

A number of test fixtures were affected (for the better) because it's
now possible to directly configure the real Cache implementation to
retrieve test content without using of test doubles.

Signed-off-by: Ben Luddy <bluddy@redhat.com>
  • Loading branch information
benluddy committed Sep 1, 2021
1 parent 03493b5 commit 9e4a778
Show file tree
Hide file tree
Showing 15 changed files with 880 additions and 998 deletions.
3 changes: 2 additions & 1 deletion pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/grpc"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver"
resolvercache "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/cache"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/solver"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/catalogsource"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/clients"
Expand Down Expand Up @@ -463,7 +464,7 @@ func (o *Operator) syncSourceState(state grpc.SourceState) {

switch state.State {
case connectivity.Ready:
o.resolver.Expire(state.Key)
o.resolver.Expire(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 9e4a778

Please sign in to comment.