[run bundle] Implement IndexImageCatalogCreator - create grpc catalog source #3467
Conversation
02905f4 to
9b0aad8
Compare
f8703cd to
c668113
Compare
ce045ae to
77429a5
Compare
77429a5 to
6194174
Compare
There was a problem hiding this comment.
The setup of this CatalogSource seems really weird to me. We're calling Init(internal.RegistryPod), but RegistryPod should be initialized by its own init method. We're also now exporting Pod, which shouldn't be since it is an internal concept.
How about doing something like what exists for packageManifestsManager, which will construct a CatalogSource in its run() method:
type BundleCmd struct {
// Flag fields
}
type bundleManager struct {
*operatorManager
version string
resourceNamespace string // Where to create OLM resources
operatorNamespace string
bundle *apimanifests.Bundle
registryPod *internalregistry.RegistryPod
objects []unstructured.Unstructured // Resources to create
client olmclient.Client
// Other required fields
}
func (c *BundleCmd) newManager() (m *bundleManager, err error) {
// Check and parse flag values, other init stuff
...
m.registryPod, err = internalregistry.NewRegistryPod(...)
if err != nil {
return nil, err
}
...
}
func (m *bundleManager) run(ctx context.Context) (err error) {
// Create registry pod and other resources
...
registryGRPCAddr := internalregistry.GetRegistryServiceAddr(
registryPod.GetPodName(),
m.resourceNamespace)
catsrc := newCatalogSource(registryPod.GetPodName(),
m.operatorNamespace,
withGRPC(registryGRPCAddr))
m.objects = append(m.objects, catsrc)
...
return m.client.DoCreate(m.objects...)
}|
@estroz @rashmigottipati I was hoping we could refactor and reuse even more of what already exists for Will there be any difference whatsoever between I'm wondering if the CLIs for |
|
@joelanford other than pod creation and some catalogsource/subscription data, they’re effectively the same. The main difference is having a slice of bundles and a package manifest vs one bundle and metadata, so just the underlying implementations of the interface you suggest. |
|
@estroz What would be different in the catalog source and subscription between the two? In both cases, aren't we pointing the catalog source to a GRPC port on a pod and creating a subscription with the package name, and catalog source name/namespace? |
I think that's right. Creation of catalog source is same for both |
|
Thanks for the inputs. Totally agree with refactoring and reusing more of the existing logic in Thinking about what would be the best approach to take: Any suggestions? |
1cf4504 to
3f76aa3
Compare
|
Added functionality to create the catalog source based on new design, @joelanford @estroz @jmrodri please take a look |
2b1a428 to
68e4e22
Compare
68e4e22 to
45f7194
Compare
The changes in this PR supercede the comments from Eric's review. Dismissing this review to keep this moving.
|
Also, we're postponing adding tests for next sprint. |
Description of the change:
Motivation for the change:
This is one of the building blocks for implementing run bundle and run bundle-upgrade commands.
Links to enhancement proposals:
https://github.com/operator-framework/enhancements/blob/master/enhancements/run-bundle.md