Skip to content

Commit

Permalink
Update catalogd dep to v0.13.0
Browse files Browse the repository at this point in the history
Fix references to Catalog and CatalogSpec
  • Loading branch information
trgeiger committed Jun 4, 2024
1 parent 9f0c6a9 commit ab2e1c6
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 40 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Process",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "cmd/manager/main.go",
"args": [

]
}
]
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/go-logr/logr v1.4.2
github.com/google/go-cmp v0.6.0
github.com/operator-framework/api v0.23.0
github.com/operator-framework/catalogd v0.12.0
github.com/operator-framework/catalogd v0.13.0
github.com/operator-framework/helm-operator-plugins v0.2.1
github.com/operator-framework/operator-registry v1.40.0
github.com/operator-framework/rukpak v0.20.1-0.20240510194410-99faf1c1763f
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/operator-framework/api v0.23.0 h1:kHymOwcHBpBVujT49SKOCd4EVG7Odwj4wl3NbOR2LLA=
github.com/operator-framework/api v0.23.0/go.mod h1:oKcFOz+Xc1UhMi2Pzcp6qsO7wjS4r+yP7EQprQBXrfM=
github.com/operator-framework/catalogd v0.12.0 h1:Cww+CyowkfTFugB9ZjUDpKvumh2vPe/TjCUpMHDmVBM=
github.com/operator-framework/catalogd v0.12.0/go.mod h1:4lryGtBTVOdqlKR0MaVYnlsSOc7HiagVRVo3J4uIo7E=
github.com/operator-framework/catalogd v0.13.0 h1:yOhEb0LpvGbZymippotpau5gFMyUnq8zMnrEYrTaJIQ=
github.com/operator-framework/catalogd v0.13.0/go.mod h1:v405w8d89Lr7K8IVE/x/Q37JtxvgdzLXGpgJxJ2Nweg=
github.com/operator-framework/helm-operator-plugins v0.2.1 h1:xPD05rYpIYKlI9VXfQBQ3XG7LFF2fALqg72lqAyFF44=
github.com/operator-framework/helm-operator-plugins v0.2.1/go.mod h1:SJyyAVYkl3tqiTJl16mz0KbGv89NhPOOGRBeQb8S4Nw=
github.com/operator-framework/operator-lib v0.12.0 h1:OzpMU5N7mvFgg/uje8FUUeD24Ahq64R6TdN25uswCYA=
Expand Down
2 changes: 1 addition & 1 deletion internal/catalogmetadata/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type filesystemCache struct {
// resources that have been successfully reconciled, unpacked, and are being served.
// These requirements help ensure that we can rely on status conditions to determine
// when to issue a request to update the cached Catalog contents.
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
if catalog == nil {
return nil, fmt.Errorf("error: provided catalog must be non-nil")
}
Expand Down
30 changes: 15 additions & 15 deletions internal/catalogmetadata/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestCache(t *testing.T) {
t.Run("FetchCatalogContents", func(t *testing.T) {
type test struct {
name string
catalog *catalogd.Catalog
catalog *catalogd.ClusterCatalog
contents []byte
wantErr bool
tripper *MockTripper
Expand All @@ -64,11 +64,11 @@ func TestCache(t *testing.T) {
for _, tt := range []test{
{
name: "valid non-cached fetch",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -82,11 +82,11 @@ func TestCache(t *testing.T) {
},
{
name: "valid cached fetch",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -102,11 +102,11 @@ func TestCache(t *testing.T) {
},
{
name: "cached update fetch with changes",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -122,11 +122,11 @@ func TestCache(t *testing.T) {
},
{
name: "fetch error",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -141,11 +141,11 @@ func TestCache(t *testing.T) {
},
{
name: "fetch internal server error response",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -167,11 +167,11 @@ func TestCache(t *testing.T) {
},
{
name: "nil catalog.status.resolvedSource",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: nil,
},
},
Expand All @@ -181,11 +181,11 @@ func TestCache(t *testing.T) {
},
{
name: "nil catalog.status.resolvedSource.image",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Image: nil,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/catalogmetadata/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Fetcher interface {
// server for the catalog provided. It returns an io.ReadCloser
// containing the FBC contents that the caller is expected to close.
// returns an error if any occur.
FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error)
FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error)
}

func New(cl client.Client, fetcher Fetcher) *Client {
Expand All @@ -46,7 +46,7 @@ type Client struct {
func (c *Client) Bundles(ctx context.Context) ([]*catalogmetadata.Bundle, error) {
var allBundles []*catalogmetadata.Bundle

var catalogList catalogd.CatalogList
var catalogList catalogd.ClusterCatalogList
if err := c.cl.List(ctx, &catalogList); err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions internal/catalogmetadata/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestClient(t *testing.T) {
name: "skip catalog missing Unpacked status condition",
fakeCatalog: func() ([]client.Object, []*catalogmetadata.Bundle, map[string][]byte) {
objs, bundles, catalogContentMap := defaultFakeCatalog()
objs = append(objs, &catalogd.Catalog{
objs = append(objs, &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "foobar",
},
Expand Down Expand Up @@ -220,11 +220,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
}`

objs := []client.Object{
&catalogd.Catalog{
&catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog-1",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
Conditions: []metav1.Condition{
{
Type: catalogd.TypeUnpacked,
Expand All @@ -234,11 +234,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
},
},
},
&catalogd.Catalog{
&catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog-2",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
Conditions: []metav1.Condition{
{
Type: catalogd.TypeUnpacked,
Expand Down Expand Up @@ -338,7 +338,7 @@ type MockFetcher struct {
shouldError bool
}

func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
if mc.shouldError {
return nil, errors.New("mock cache error")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,12 @@ func (r *ClusterExtensionReconciler) generateBundleDeploymentForUnpack(bundlePat
func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error {
controller, err := ctrl.NewControllerManagedBy(mgr).
For(&ocv1alpha1.ClusterExtension{}).
Watches(&catalogd.Catalog{},
Watches(&catalogd.ClusterCatalog{},
crhandler.EnqueueRequestsFromMapFunc(clusterExtensionRequestsForCatalog(mgr.GetClient(), mgr.GetLogger()))).
WithEventFilter(predicate.Funcs{
UpdateFunc: func(ue event.UpdateEvent) bool {
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.Catalog)
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.Catalog)
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.ClusterCatalog)
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.ClusterCatalog)

if !isOldCatalog || !isNewCatalog {
return true
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/cluster_extension_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
var pollDuration = time.Minute
var pollInterval = time.Second

func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, *catalogd.Catalog) {
func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, *catalogd.ClusterCatalog) {
var err error
extensionCatalog, err := createTestCatalog(context.Background(), testCatalogName, os.Getenv(testCatalogRefEnvVar))
require.NoError(t, err)
Expand All @@ -51,10 +51,10 @@ func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, *catalogd.Catalog) {
return clusterExtension, extensionCatalog
}

func testCleanup(t *testing.T, cat *catalogd.Catalog, clusterExtension *ocv1alpha1.ClusterExtension) {
func testCleanup(t *testing.T, cat *catalogd.ClusterCatalog, clusterExtension *ocv1alpha1.ClusterExtension) {
require.NoError(t, c.Delete(context.Background(), cat))
require.Eventually(t, func() bool {
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.Catalog{})
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.ClusterCatalog{})
return errors.IsNotFound(err)
}, pollDuration, pollInterval)
require.NoError(t, c.Delete(context.Background(), clusterExtension))
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
t.Log("By deleting the catalog first")
require.NoError(t, c.Delete(context.Background(), extensionCatalog))
require.EventuallyWithT(t, func(ct *assert.CollectT) {
err := c.Get(context.Background(), types.NamespacedName{Name: extensionCatalog.Name}, &catalogd.Catalog{})
err := c.Get(context.Background(), types.NamespacedName{Name: extensionCatalog.Name}, &catalogd.ClusterCatalog{})
assert.True(ct, errors.IsNotFound(err))
}, pollDuration, pollInterval)

Expand Down Expand Up @@ -366,7 +366,7 @@ func getArtifactsOutput(t *testing.T) {
}

// get all catalogsources save them to the artifact path.
catalogsources := catalogd.CatalogList{}
catalogsources := catalogd.ClusterCatalogList{}
if err := c.List(context.Background(), &catalogsources, client.InNamespace("")); err != nil {
fmt.Printf("Failed to list catalogsources: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func TestMain(m *testing.M) {
// createTestCatalog will create a new catalog on the test cluster, provided
// the context, catalog name, and the image reference. It returns the created catalog
// or an error if any errors occurred while creating the catalog.
func createTestCatalog(ctx context.Context, name string, imageRef string) (*catalogd.Catalog, error) {
catalog := &catalogd.Catalog{
func createTestCatalog(ctx context.Context, name string, imageRef string) (*catalogd.ClusterCatalog, error) {
catalog := &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: catalogd.CatalogSpec{
Spec: catalogd.ClusterCatalogSpec{
Source: catalogd.CatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ImageSource{
Expand Down
4 changes: 2 additions & 2 deletions test/extension-developer-e2e/extension_developer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func TestExtensionDeveloper(t *testing.T) {
clusterExtension := ce
t.Run(clusterExtension.ObjectMeta.Name, func(t *testing.T) {
t.Parallel()
catalog := &catalogd.Catalog{
catalog := &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "catalog",
},
Spec: catalogd.CatalogSpec{
Spec: catalogd.ClusterCatalogSpec{
Source: catalogd.CatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ImageSource{
Expand Down

0 comments on commit ab2e1c6

Please sign in to comment.