Skip to content

Commit 5479625

Browse files
committed
fix: Rename Catalog to ClusterCatalog object
Rename Catalog to ClusterCatalog to conform with the changes in catalogd. See [issue operator-framework#268](operator-framework/catalogd/pull/268) Signed-off-by: Edmund Ochieng <[email protected]>
1 parent bd6866f commit 5479625

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

config/samples/catalogd_operatorcatalog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: catalogd.operatorframework.io/v1alpha1
2-
kind: Catalog
2+
kind: ClusterCatalog
33
metadata:
44
name: operatorhubio
55
spec:

docs/Tasks/adding-a-catalog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This catalog is distributed as an image [quay.io/operatorhubio/catalog](https://
2222

2323
``` yaml title="catalog_cr.yaml"
2424
apiVersion: catalogd.operatorframework.io/v1alpha1
25-
kind: Catalog
25+
kind: ClusterCatalog
2626
metadata:
2727
name: operatorhubio
2828
spec:
@@ -44,7 +44,7 @@ This catalog is distributed as an image [quay.io/operatorhubio/catalog](https://
4444

4545
``` yaml title="Example `operatorhubio.yaml` CR"
4646
apiVersion: catalogd.operatorframework.io/v1alpha1
47-
kind: Catalog
47+
kind: ClusterCatalog
4848
metadata:
4949
name: operatorhub
5050
spec:

internal/catalogmetadata/cache/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type filesystemCache struct {
6666
// resources that have been successfully reconciled, unpacked, and are being served.
6767
// These requirements help ensure that we can rely on status conditions to determine
6868
// when to issue a request to update the cached Catalog contents.
69-
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
69+
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
7070
if catalog == nil {
7171
return nil, fmt.Errorf("error: provided catalog must be non-nil")
7272
}

internal/catalogmetadata/cache/cache_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestCache(t *testing.T) {
5454
t.Run("FetchCatalogContents", func(t *testing.T) {
5555
type test struct {
5656
name string
57-
catalog *catalogd.Catalog
57+
catalog *catalogd.ClusterCatalog
5858
contents []byte
5959
wantErr bool
6060
tripper *MockTripper
@@ -64,11 +64,11 @@ func TestCache(t *testing.T) {
6464
for _, tt := range []test{
6565
{
6666
name: "valid non-cached fetch",
67-
catalog: &catalogd.Catalog{
67+
catalog: &catalogd.ClusterCatalog{
6868
ObjectMeta: metav1.ObjectMeta{
6969
Name: "test-catalog",
7070
},
71-
Status: catalogd.CatalogStatus{
71+
Status: catalogd.ClusterCatalogStatus{
7272
ResolvedSource: &catalogd.ResolvedCatalogSource{
7373
Type: catalogd.SourceTypeImage,
7474
Image: &catalogd.ResolvedImageSource{
@@ -82,11 +82,11 @@ func TestCache(t *testing.T) {
8282
},
8383
{
8484
name: "valid cached fetch",
85-
catalog: &catalogd.Catalog{
85+
catalog: &catalogd.ClusterCatalog{
8686
ObjectMeta: metav1.ObjectMeta{
8787
Name: "test-catalog",
8888
},
89-
Status: catalogd.CatalogStatus{
89+
Status: catalogd.ClusterCatalogStatus{
9090
ResolvedSource: &catalogd.ResolvedCatalogSource{
9191
Type: catalogd.SourceTypeImage,
9292
Image: &catalogd.ResolvedImageSource{
@@ -102,11 +102,11 @@ func TestCache(t *testing.T) {
102102
},
103103
{
104104
name: "cached update fetch with changes",
105-
catalog: &catalogd.Catalog{
105+
catalog: &catalogd.ClusterCatalog{
106106
ObjectMeta: metav1.ObjectMeta{
107107
Name: "test-catalog",
108108
},
109-
Status: catalogd.CatalogStatus{
109+
Status: catalogd.ClusterCatalogStatus{
110110
ResolvedSource: &catalogd.ResolvedCatalogSource{
111111
Type: catalogd.SourceTypeImage,
112112
Image: &catalogd.ResolvedImageSource{
@@ -122,11 +122,11 @@ func TestCache(t *testing.T) {
122122
},
123123
{
124124
name: "fetch error",
125-
catalog: &catalogd.Catalog{
125+
catalog: &catalogd.ClusterCatalog{
126126
ObjectMeta: metav1.ObjectMeta{
127127
Name: "test-catalog",
128128
},
129-
Status: catalogd.CatalogStatus{
129+
Status: catalogd.ClusterCatalogStatus{
130130
ResolvedSource: &catalogd.ResolvedCatalogSource{
131131
Type: catalogd.SourceTypeImage,
132132
Image: &catalogd.ResolvedImageSource{
@@ -141,11 +141,11 @@ func TestCache(t *testing.T) {
141141
},
142142
{
143143
name: "fetch internal server error response",
144-
catalog: &catalogd.Catalog{
144+
catalog: &catalogd.ClusterCatalog{
145145
ObjectMeta: metav1.ObjectMeta{
146146
Name: "test-catalog",
147147
},
148-
Status: catalogd.CatalogStatus{
148+
Status: catalogd.ClusterCatalogStatus{
149149
ResolvedSource: &catalogd.ResolvedCatalogSource{
150150
Type: catalogd.SourceTypeImage,
151151
Image: &catalogd.ResolvedImageSource{
@@ -167,11 +167,11 @@ func TestCache(t *testing.T) {
167167
},
168168
{
169169
name: "nil catalog.status.resolvedSource",
170-
catalog: &catalogd.Catalog{
170+
catalog: &catalogd.ClusterCatalog{
171171
ObjectMeta: metav1.ObjectMeta{
172172
Name: "test-catalog",
173173
},
174-
Status: catalogd.CatalogStatus{
174+
Status: catalogd.ClusterCatalogStatus{
175175
ResolvedSource: nil,
176176
},
177177
},
@@ -181,11 +181,11 @@ func TestCache(t *testing.T) {
181181
},
182182
{
183183
name: "nil catalog.status.resolvedSource.image",
184-
catalog: &catalogd.Catalog{
184+
catalog: &catalogd.ClusterCatalog{
185185
ObjectMeta: metav1.ObjectMeta{
186186
Name: "test-catalog",
187187
},
188-
Status: catalogd.CatalogStatus{
188+
Status: catalogd.ClusterCatalogStatus{
189189
ResolvedSource: &catalogd.ResolvedCatalogSource{
190190
Image: nil,
191191
},

internal/catalogmetadata/client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Fetcher interface {
2323
// server for the catalog provided. It returns an io.ReadCloser
2424
// containing the FBC contents that the caller is expected to close.
2525
// returns an error if any occur.
26-
FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error)
26+
FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error)
2727
}
2828

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

49-
var catalogList catalogd.CatalogList
49+
var catalogList catalogd.ClusterCatalogList
5050
if err := c.cl.List(ctx, &catalogList); err != nil {
5151
return nil, err
5252
}

internal/catalogmetadata/client/client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestClient(t *testing.T) {
105105
name: "skip catalog missing Unpacked status condition",
106106
fakeCatalog: func() ([]client.Object, []*catalogmetadata.Bundle, map[string][]byte) {
107107
objs, bundles, catalogContentMap := defaultFakeCatalog()
108-
objs = append(objs, &catalogd.Catalog{
108+
objs = append(objs, &catalogd.ClusterCatalog{
109109
ObjectMeta: metav1.ObjectMeta{
110110
Name: "foobar",
111111
},
@@ -220,11 +220,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
220220
}`
221221

222222
objs := []client.Object{
223-
&catalogd.Catalog{
223+
&catalogd.ClusterCatalog{
224224
ObjectMeta: metav1.ObjectMeta{
225225
Name: "catalog-1",
226226
},
227-
Status: catalogd.CatalogStatus{
227+
Status: catalogd.ClusterCatalogStatus{
228228
Conditions: []metav1.Condition{
229229
{
230230
Type: catalogd.TypeUnpacked,
@@ -234,11 +234,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
234234
},
235235
},
236236
},
237-
&catalogd.Catalog{
237+
&catalogd.ClusterCatalog{
238238
ObjectMeta: metav1.ObjectMeta{
239239
Name: "catalog-2",
240240
},
241-
Status: catalogd.CatalogStatus{
241+
Status: catalogd.ClusterCatalogStatus{
242242
Conditions: []metav1.Condition{
243243
{
244244
Type: catalogd.TypeUnpacked,
@@ -338,7 +338,7 @@ type MockFetcher struct {
338338
shouldError bool
339339
}
340340

341-
func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
341+
func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
342342
if mc.shouldError {
343343
return nil, errors.New("mock cache error")
344344
}

internal/controllers/clusterextension_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,12 @@ func isInsecureSkipTLSVerifySet(ce *ocv1alpha1.ClusterExtension) bool {
555555
func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error {
556556
controller, err := ctrl.NewControllerManagedBy(mgr).
557557
For(&ocv1alpha1.ClusterExtension{}).
558-
Watches(&catalogd.Catalog{},
558+
Watches(&catalogd.ClusterCatalog{},
559559
crhandler.EnqueueRequestsFromMapFunc(clusterExtensionRequestsForCatalog(mgr.GetClient(), mgr.GetLogger()))).
560560
WithEventFilter(predicate.Funcs{
561561
UpdateFunc: func(ue event.UpdateEvent) bool {
562-
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.Catalog)
563-
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.Catalog)
562+
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.ClusterCatalog)
563+
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.ClusterCatalog)
564564

565565
if !isOldCatalog || !isNewCatalog {
566566
return true

0 commit comments

Comments
 (0)