From 4f1219c71029492a83eb20888f9d71eeb0c354d6 Mon Sep 17 00:00:00 2001 From: Bryce Palmer Date: Wed, 15 May 2024 09:57:49 -0400 Subject: [PATCH] rename Catalog to ClusterCatalog (#268) Signed-off-by: everettraven --- Makefile | 2 +- README.md | 10 +- ...talog_types.go => clustercatalog_types.go} | 30 ++-- ...s_test.go => clustercatalog_types_test.go} | 8 +- api/core/v1alpha1/zz_generated.deepcopy.go | 78 ++++----- cmd/manager/main.go | 4 +- ...operatorframework.io_clustercatalogs.yaml} | 22 +-- config/base/crd/kustomization.yaml | 2 +- config/base/rbac/role.yaml | 6 +- config/rbac/role.yaml | 6 +- ...yaml => core_v1alpha1_clustercatalog.yaml} | 2 +- docs/fetching-catalog-contents.md | 24 +-- .../garbagecollection/garbage_collector.go | 4 +- .../garbage_collector_test.go | 6 +- internal/source/image_registry_client.go | 6 +- internal/source/image_registry_client_test.go | 50 +++--- internal/source/unpacker.go | 8 +- ...roller.go => clustercatalog_controller.go} | 36 ++-- ...t.go => clustercatalog_controller_test.go} | 164 +++++++++--------- test/e2e/unpack_test.go | 14 +- 20 files changed, 241 insertions(+), 241 deletions(-) rename api/core/v1alpha1/{catalog_types.go => clustercatalog_types.go} (87%) rename api/core/v1alpha1/{catalog_types_test.go => clustercatalog_types_test.go} (96%) rename config/base/crd/bases/{catalogd.operatorframework.io_catalogs.yaml => catalogd.operatorframework.io_clustercatalogs.yaml} (94%) rename config/samples/{core_v1alpha1_catalog.yaml => core_v1alpha1_clustercatalog.yaml} (90%) rename pkg/controllers/core/{catalog_controller.go => clustercatalog_controller.go} (86%) rename pkg/controllers/core/{catalog_controller_test.go => clustercatalog_controller_test.go} (81%) diff --git a/Makefile b/Makefile index fa25b8f7..149325b8 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ clean: ## Remove binaries and test artifacts .PHONY: generate generate: $(CONTROLLER_GEN) ## Generate code and manifests. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/base/rbac .PHONY: fmt fmt: ## Run go fmt against code. diff --git a/README.md b/README.md index c6ae5b02..06d67ac4 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A 1. To install catalogd, navigate to the [releases](https://github.com/operator-framework/catalogd/releases/) page, and follow the install instructions included in the release you want to install. -1. Create a `Catalog` object that points to the OperatorHub Community catalog by running the following command: +1. Create a `ClusterCatalog` object that points to the OperatorHub Community catalog by running the following command: ```sh $ kubectl apply -f - << EOF apiVersion: catalogd.operatorframework.io/v1alpha1 - kind: Catalog + kind: ClusterCatalog metadata: name: operatorhubio spec: @@ -30,10 +30,10 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A EOF ``` -1. Verify the `Catalog` object was created successfully by running the following command: +1. Verify the `ClusterCatalog` object was created successfully by running the following command: ```sh - $ kubectl describe catalog/operatorhubio + $ kubectl describe clustercatalog/operatorhubio ``` *Example output* @@ -43,7 +43,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A Labels: Annotations: API Version: catalogd.operatorframework.io/v1alpha1 - Kind: Catalog + Kind: ClusterCatalog Metadata: Creation Timestamp: 2023-06-23T18:35:13Z Generation: 1 diff --git a/api/core/v1alpha1/catalog_types.go b/api/core/v1alpha1/clustercatalog_types.go similarity index 87% rename from api/core/v1alpha1/catalog_types.go rename to api/core/v1alpha1/clustercatalog_types.go index f99a547e..268ec37e 100644 --- a/api/core/v1alpha1/catalog_types.go +++ b/api/core/v1alpha1/clustercatalog_types.go @@ -50,36 +50,36 @@ const ( //+kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` //+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp` -// Catalog is the Schema for the Catalogs API -type Catalog struct { +// ClusterCatalog is the Schema for the ClusterCatalogs API +type ClusterCatalog struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec CatalogSpec `json:"spec,omitempty"` - Status CatalogStatus `json:"status,omitempty"` + Spec ClusterCatalogSpec `json:"spec,omitempty"` + Status ClusterCatalogStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// CatalogList contains a list of Catalog -type CatalogList struct { +// ClusterCatalogList contains a list of ClusterCatalog +type ClusterCatalogList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []Catalog `json:"items"` + Items []ClusterCatalog `json:"items"` } -// CatalogSpec defines the desired state of Catalog +// ClusterCatalogSpec defines the desired state of ClusterCatalog // +kubebuilder:validation:XValidation:rule="!has(self.source.image.pollInterval) || (self.source.image.ref.find('@sha256:') == \"\")",message="cannot specify PollInterval while using digest-based image" -type CatalogSpec struct { +type ClusterCatalogSpec struct { // Source is the source of a Catalog that contains Operators' metadata in the FBC format // https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs Source CatalogSource `json:"source"` } -// CatalogStatus defines the observed state of Catalog -type CatalogStatus struct { - // Conditions store the status conditions of the Catalog instances +// ClusterCatalogStatus defines the observed state of ClusterCatalog +type ClusterCatalogStatus struct { + // Conditions store the status conditions of the ClusterCatalog instances Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` // ResolvedSource contains information about the resolved source @@ -90,8 +90,8 @@ type CatalogStatus struct { // ContentURL is a cluster-internal address that on-cluster components // can read the content of a catalog from ContentURL string `json:"contentURL,omitempty"` - // observedGeneration is the most recent generation observed for this Catalog. It corresponds to the - // Catalog's generation, which is updated on mutation by the API Server. + // observedGeneration is the most recent generation observed for this ClusterCatalog. It corresponds to the + // ClusterCatalog's generation, which is updated on mutation by the API Server. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } @@ -145,5 +145,5 @@ type ImageSource struct { } func init() { - SchemeBuilder.Register(&Catalog{}, &CatalogList{}) + SchemeBuilder.Register(&ClusterCatalog{}, &ClusterCatalogList{}) } diff --git a/api/core/v1alpha1/catalog_types_test.go b/api/core/v1alpha1/clustercatalog_types_test.go similarity index 96% rename from api/core/v1alpha1/catalog_types_test.go rename to api/core/v1alpha1/clustercatalog_types_test.go index 352445ab..1aaaf459 100644 --- a/api/core/v1alpha1/catalog_types_test.go +++ b/api/core/v1alpha1/clustercatalog_types_test.go @@ -20,17 +20,17 @@ import ( ) func TestPollIntervalCELValidationRules(t *testing.T) { - validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/catalogd.operatorframework.io_catalogs.yaml") + validators := fieldValidatorsFromFile(t, "../../../config/base/crd/bases/catalogd.operatorframework.io_clustercatalogs.yaml") pth := "openAPIV3Schema.properties.spec" validator, found := validators["v1alpha1"][pth] assert.True(t, found) for name, tc := range map[string]struct { - spec CatalogSpec + spec ClusterCatalogSpec wantErrs []string }{ "digest based image ref, poll interval not allowed, poll interval specified": { - spec: CatalogSpec{ + spec: ClusterCatalogSpec{ Source: CatalogSource{ Type: SourceTypeImage, Image: &ImageSource{ @@ -44,7 +44,7 @@ func TestPollIntervalCELValidationRules(t *testing.T) { }, }, "digest based image ref, poll interval not allowed, poll interval not specified": { - spec: CatalogSpec{ + spec: ClusterCatalogSpec{ Source: CatalogSource{ Type: SourceTypeImage, Image: &ImageSource{ diff --git a/api/core/v1alpha1/zz_generated.deepcopy.go b/api/core/v1alpha1/zz_generated.deepcopy.go index 2839f564..ef824ed1 100644 --- a/api/core/v1alpha1/zz_generated.deepcopy.go +++ b/api/core/v1alpha1/zz_generated.deepcopy.go @@ -26,7 +26,27 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Catalog) DeepCopyInto(out *Catalog) { +func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageSource) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSource. +func (in *CatalogSource) DeepCopy() *CatalogSource { + if in == nil { + return nil + } + out := new(CatalogSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterCatalog) DeepCopyInto(out *ClusterCatalog) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -34,18 +54,18 @@ func (in *Catalog) DeepCopyInto(out *Catalog) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Catalog. -func (in *Catalog) DeepCopy() *Catalog { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCatalog. +func (in *ClusterCatalog) DeepCopy() *ClusterCatalog { if in == nil { return nil } - out := new(Catalog) + out := new(ClusterCatalog) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Catalog) DeepCopyObject() runtime.Object { +func (in *ClusterCatalog) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -53,31 +73,31 @@ func (in *Catalog) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CatalogList) DeepCopyInto(out *CatalogList) { +func (in *ClusterCatalogList) DeepCopyInto(out *ClusterCatalogList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Catalog, len(*in)) + *out = make([]ClusterCatalog, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogList. -func (in *CatalogList) DeepCopy() *CatalogList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCatalogList. +func (in *ClusterCatalogList) DeepCopy() *ClusterCatalogList { if in == nil { return nil } - out := new(CatalogList) + out := new(ClusterCatalogList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CatalogList) DeepCopyObject() runtime.Object { +func (in *ClusterCatalogList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -85,43 +105,23 @@ func (in *CatalogList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { - *out = *in - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(ImageSource) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSource. -func (in *CatalogSource) DeepCopy() *CatalogSource { - if in == nil { - return nil - } - out := new(CatalogSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CatalogSpec) DeepCopyInto(out *CatalogSpec) { +func (in *ClusterCatalogSpec) DeepCopyInto(out *ClusterCatalogSpec) { *out = *in in.Source.DeepCopyInto(&out.Source) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSpec. -func (in *CatalogSpec) DeepCopy() *CatalogSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCatalogSpec. +func (in *ClusterCatalogSpec) DeepCopy() *ClusterCatalogSpec { if in == nil { return nil } - out := new(CatalogSpec) + out := new(ClusterCatalogSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CatalogStatus) DeepCopyInto(out *CatalogStatus) { +func (in *ClusterCatalogStatus) DeepCopyInto(out *ClusterCatalogStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -137,12 +137,12 @@ func (in *CatalogStatus) DeepCopyInto(out *CatalogStatus) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogStatus. -func (in *CatalogStatus) DeepCopy() *CatalogStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCatalogStatus. +func (in *ClusterCatalogStatus) DeepCopy() *ClusterCatalogStatus { if in == nil { return nil } - out := new(CatalogStatus) + out := new(ClusterCatalogStatus) in.DeepCopyInto(out) return out } diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 49890a47..98ecb3d4 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -180,12 +180,12 @@ func main() { os.Exit(1) } - if err = (&corecontrollers.CatalogReconciler{ + if err = (&corecontrollers.ClusterCatalogReconciler{ Client: mgr.GetClient(), Unpacker: unpacker, Storage: localStorage, }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Catalog") + setupLog.Error(err, "unable to create controller", "controller", "ClusterCatalog") os.Exit(1) } //+kubebuilder:scaffold:builder diff --git a/config/base/crd/bases/catalogd.operatorframework.io_catalogs.yaml b/config/base/crd/bases/catalogd.operatorframework.io_clustercatalogs.yaml similarity index 94% rename from config/base/crd/bases/catalogd.operatorframework.io_catalogs.yaml rename to config/base/crd/bases/catalogd.operatorframework.io_clustercatalogs.yaml index 65a2fc03..dc3db2e5 100644 --- a/config/base/crd/bases/catalogd.operatorframework.io_catalogs.yaml +++ b/config/base/crd/bases/catalogd.operatorframework.io_clustercatalogs.yaml @@ -4,14 +4,14 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: catalogs.catalogd.operatorframework.io + name: clustercatalogs.catalogd.operatorframework.io spec: group: catalogd.operatorframework.io names: - kind: Catalog - listKind: CatalogList - plural: catalogs - singular: catalog + kind: ClusterCatalog + listKind: ClusterCatalogList + plural: clustercatalogs + singular: clustercatalog scope: Cluster versions: - additionalPrinterColumns: @@ -24,7 +24,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: Catalog is the Schema for the Catalogs API + description: ClusterCatalog is the Schema for the ClusterCatalogs API properties: apiVersion: description: |- @@ -44,7 +44,7 @@ spec: metadata: type: object spec: - description: CatalogSpec defines the desired state of Catalog + description: ClusterCatalogSpec defines the desired state of ClusterCatalog properties: source: description: |- @@ -96,10 +96,10 @@ spec: rule: '!has(self.source.image.pollInterval) || (self.source.image.ref.find(''@sha256:'') == "")' status: - description: CatalogStatus defines the observed state of Catalog + description: ClusterCatalogStatus defines the observed state of ClusterCatalog properties: conditions: - description: Conditions store the status conditions of the Catalog + description: Conditions store the status conditions of the ClusterCatalog instances items: description: "Condition contains details for one aspect of the current @@ -176,8 +176,8 @@ spec: type: string observedGeneration: description: |- - observedGeneration is the most recent generation observed for this Catalog. It corresponds to the - Catalog's generation, which is updated on mutation by the API Server. + observedGeneration is the most recent generation observed for this ClusterCatalog. It corresponds to the + ClusterCatalog's generation, which is updated on mutation by the API Server. format: int64 type: integer phase: diff --git a/config/base/crd/kustomization.yaml b/config/base/crd/kustomization.yaml index fc01b245..5a7e7bc7 100644 --- a/config/base/crd/kustomization.yaml +++ b/config/base/crd/kustomization.yaml @@ -2,7 +2,7 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/catalogd.operatorframework.io_catalogs.yaml +- bases/catalogd.operatorframework.io_clustercatalogs.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: diff --git a/config/base/rbac/role.yaml b/config/base/rbac/role.yaml index 66f6922a..7e4ec5e7 100644 --- a/config/base/rbac/role.yaml +++ b/config/base/rbac/role.yaml @@ -7,7 +7,7 @@ rules: - apiGroups: - catalogd.operatorframework.io resources: - - catalogs + - clustercatalogs verbs: - create - delete @@ -19,13 +19,13 @@ rules: - apiGroups: - catalogd.operatorframework.io resources: - - catalogs/finalizers + - clustercatalogs/finalizers verbs: - update - apiGroups: - catalogd.operatorframework.io resources: - - catalogs/status + - clustercatalogs/status verbs: - get - patch diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 66f6922a..7e4ec5e7 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -7,7 +7,7 @@ rules: - apiGroups: - catalogd.operatorframework.io resources: - - catalogs + - clustercatalogs verbs: - create - delete @@ -19,13 +19,13 @@ rules: - apiGroups: - catalogd.operatorframework.io resources: - - catalogs/finalizers + - clustercatalogs/finalizers verbs: - update - apiGroups: - catalogd.operatorframework.io resources: - - catalogs/status + - clustercatalogs/status verbs: - get - patch diff --git a/config/samples/core_v1alpha1_catalog.yaml b/config/samples/core_v1alpha1_clustercatalog.yaml similarity index 90% rename from config/samples/core_v1alpha1_catalog.yaml rename to config/samples/core_v1alpha1_clustercatalog.yaml index 0158ab20..250e8325 100644 --- a/config/samples/core_v1alpha1_catalog.yaml +++ b/config/samples/core_v1alpha1_clustercatalog.yaml @@ -1,5 +1,5 @@ apiVersion: catalogd.operatorframework.io/v1alpha1 -kind: Catalog +kind: ClusterCatalog metadata: name: operatorhubio spec: diff --git a/docs/fetching-catalog-contents.md b/docs/fetching-catalog-contents.md index b948388c..e09fb5be 100644 --- a/docs/fetching-catalog-contents.md +++ b/docs/fetching-catalog-contents.md @@ -1,16 +1,16 @@ -# Fetching `Catalog` contents from the Catalogd HTTP Server -This document covers how to fetch the contents for a `Catalog` from the +# Fetching `ClusterCatalog` contents from the Catalogd HTTP Server +This document covers how to fetch the contents for a `ClusterCatalog` from the Catalogd HTTP(S) Server. For example purposes we make the following assumption: -- A `Catalog` named `operatorhubio` has been created and successfully unpacked -(denoted in the `Catalog.Status`) +- A `ClusterCatalog` named `operatorhubio` has been created and successfully unpacked +(denoted in the `ClusterCatalog.Status`) **NOTE:** By default, Catalogd is configured to use TLS with self-signed certificates. For local development, consider skipping TLS verification, such as `curl -k`, or reference external material on self-signed certificate verification. -`Catalog` CRs have a status.contentURL field whose value is the location where the content +`ClusterCatalog` CRs have a status.contentURL field whose value is the location where the content of a catalog can be read from: ```yaml @@ -35,7 +35,7 @@ object. ## On cluster -When making a request for the contents of the `operatorhubio` `Catalog` from within +When making a request for the contents of the `operatorhubio` `ClusterCatalog` from within the cluster issue a HTTP `GET` request to `https://catalogd-catalogserver.catalogd-system.svc/catalogs/operatorhubio/all.json` @@ -46,7 +46,7 @@ kubectl run fetcher --image=curlimages/curl:latest -- curl https://catalogd-cata ## Off cluster -When making a request for the contents of the `operatorhubio` `Catalog` from outside +When making a request for the contents of the `operatorhubio` `ClusterCatalog` from outside the cluster, we have to perform an extra step: 1. Port forward the `catalogd-catalogserver` service in the `catalogd-system` namespace: ```sh @@ -61,7 +61,7 @@ An example `curl` request that assumes the port-forwarding is mapped to port 808 curl http://localhost:8080/catalogs/operatorhubio/all.json ``` -# Fetching `Catalog` contents from the `Catalogd` Service outside of the cluster +# Fetching `ClusterCatalog` contents from the `Catalogd` Service outside of the cluster This section outlines a way of exposing the `Catalogd` Service's endpoints outside the cluster and then accessing the catalog contents using `Ingress`. We will be using `Ingress NGINX` Controller for the sake of this example but you are welcome to use the `Ingress` Controller of your choice. @@ -77,12 +77,12 @@ This section outlines a way of exposing the `Catalogd` Service's endpoints outsi ``` By running that above command, the `Ingress` Controller is installed. Along with it, the `Ingress` Resource will be applied automatically as well, thereby creating an `Ingress` Object on the cluster. -1. Once the prerequisites are satisfied, create a `Catalog` object that points to the OperatorHub Community catalog by running the following command: +1. Once the prerequisites are satisfied, create a `ClusterCatalog` object that points to the OperatorHub Community catalog by running the following command: ```sh $ kubectl apply -f - << EOF apiVersion: catalogd.operatorframework.io/v1alpha1 - kind: Catalog + kind: ClusterCatalog metadata: name: operatorhubio spec: @@ -93,13 +93,13 @@ This section outlines a way of exposing the `Catalogd` Service's endpoints outsi EOF ``` -1. Before proceeding further, let's verify that the `Catalog` object was created successfully by running the below command: +1. Before proceeding further, let's verify that the `ClusterCatalog` object was created successfully by running the below command: ```sh $ kubectl describe catalog/operatorhubio ``` -1. At this point the `Catalog` object exists and `Ingress` controller is ready to process requests. The sample `Ingress` Resource that was created during Step 4 of Prerequisites is shown as below: +1. At this point the `ClusterCatalog` object exists and `Ingress` controller is ready to process requests. The sample `Ingress` Resource that was created during Step 4 of Prerequisites is shown as below: ```yaml apiVersion: networking.k8s.io/v1 diff --git a/internal/garbagecollection/garbage_collector.go b/internal/garbagecollection/garbage_collector.go index 0ebb3abc..b2579748 100644 --- a/internal/garbagecollection/garbage_collector.go +++ b/internal/garbagecollection/garbage_collector.go @@ -64,10 +64,10 @@ func (gc *GarbageCollector) Start(ctx context.Context) error { } func runGarbageCollection(ctx context.Context, cachePath string, metaClient metadata.Interface) ([]string, error) { - getter := metaClient.Resource(v1alpha1.GroupVersion.WithResource("catalogs")) + getter := metaClient.Resource(v1alpha1.GroupVersion.WithResource("clustercatalogs")) metaList, err := getter.List(ctx, metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("error listing catalogs: %w", err) + return nil, fmt.Errorf("error listing clustercatalogs: %w", err) } expectedCatalogs := sets.New[string]() diff --git a/internal/garbagecollection/garbage_collector_test.go b/internal/garbagecollection/garbage_collector_test.go index c2e324ec..59f045d9 100644 --- a/internal/garbagecollection/garbage_collector_test.go +++ b/internal/garbagecollection/garbage_collector_test.go @@ -27,7 +27,7 @@ func TestRunGarbageCollection(t *testing.T) { existCatalogs: []*metav1.PartialObjectMetadata{ { TypeMeta: metav1.TypeMeta{ - Kind: "Catalog", + Kind: "ClusterCatalog", APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ @@ -36,7 +36,7 @@ func TestRunGarbageCollection(t *testing.T) { }, { TypeMeta: metav1.TypeMeta{ - Kind: "Catalog", + Kind: "ClusterCatalog", APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ @@ -47,7 +47,7 @@ func TestRunGarbageCollection(t *testing.T) { notExistCatalogs: []*metav1.PartialObjectMetadata{ { TypeMeta: metav1.TypeMeta{ - Kind: "Catalog", + Kind: "ClusterCatalog", APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ diff --git a/internal/source/image_registry_client.go b/internal/source/image_registry_client.go index b1285c23..ef825245 100644 --- a/internal/source/image_registry_client.go +++ b/internal/source/image_registry_client.go @@ -35,7 +35,7 @@ type ImageRegistry struct { const ConfigDirLabel = "operators.operatorframework.io.index.configs.v1" -func (i *ImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1alpha1.Catalog) (*Result, error) { +func (i *ImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) (*Result, error) { l := log.FromContext(ctx) if catalog.Spec.Source.Type != catalogdv1alpha1.SourceTypeImage { panic(fmt.Sprintf("programmer error: source type %q is unable to handle specified catalog source type %q", catalogdv1alpha1.SourceTypeImage, catalog.Spec.Source.Type)) @@ -132,11 +132,11 @@ func wrapUnrecoverable(err error, isUnrecoverable bool) error { return err } -func (i *ImageRegistry) Cleanup(_ context.Context, catalog *catalogdv1alpha1.Catalog) error { +func (i *ImageRegistry) Cleanup(_ context.Context, catalog *catalogdv1alpha1.ClusterCatalog) error { return os.RemoveAll(filepath.Join(i.BaseCachePath, catalog.Name)) } -func unpackedResult(fsys fs.FS, catalog *catalogdv1alpha1.Catalog, ref string) *Result { +func unpackedResult(fsys fs.FS, catalog *catalogdv1alpha1.ClusterCatalog, ref string) *Result { return &Result{ FS: fsys, ResolvedSource: &catalogdv1alpha1.ResolvedCatalogSource{ diff --git a/internal/source/image_registry_client_test.go b/internal/source/image_registry_client_test.go index fce34339..5982b8fb 100644 --- a/internal/source/image_registry_client_test.go +++ b/internal/source/image_registry_client_test.go @@ -32,7 +32,7 @@ func TestImageRegistry(t *testing.T) { // if the Catalog.Spec.Source.Image.Ref field is empty, // one is injected during test runtime to ensure it // points to the registry created for the test - catalog *v1alpha1.Catalog + catalog *v1alpha1.ClusterCatalog wantErr bool unrecoverable bool image v1.Image @@ -44,11 +44,11 @@ func TestImageRegistry(t *testing.T) { }{ { name: ".spec.source.image is nil", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: nil, @@ -61,11 +61,11 @@ func TestImageRegistry(t *testing.T) { }, { name: ".spec.source.image.ref is unparsable", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -80,11 +80,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag based, image is missing required label", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -105,11 +105,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest based, image is missing required label", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -131,11 +131,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "image doesn't exist", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -149,11 +149,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag based image, digest already exists in cache", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -175,11 +175,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest based image, digest already exists in cache", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -201,11 +201,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "old ref is cached", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -235,11 +235,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "tag ref, happy path", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -268,11 +268,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest ref, happy path", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -301,11 +301,11 @@ func TestImageRegistry(t *testing.T) { }, { name: "digest ref, insecure specified, happy path", - catalog: &v1alpha1.Catalog{ + catalog: &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ @@ -441,11 +441,11 @@ func TestImageRegistryMissingLabelConsistentFailure(t *testing.T) { err = remote.Write(imgName, image) require.NoError(t, err) - catalog := &v1alpha1.Catalog{ + catalog := &v1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: v1alpha1.CatalogSpec{ + Spec: v1alpha1.ClusterCatalogSpec{ Source: v1alpha1.CatalogSource{ Type: v1alpha1.SourceTypeImage, Image: &v1alpha1.ImageSource{ diff --git a/internal/source/unpacker.go b/internal/source/unpacker.go index 3059a38e..f2ca09a2 100644 --- a/internal/source/unpacker.go +++ b/internal/source/unpacker.go @@ -31,8 +31,8 @@ import ( // specifications. A source should treat a catalog root directory as an opaque // file tree and delegate catalog format concerns to catalog parsers. type Unpacker interface { - Unpack(context.Context, *catalogdv1alpha1.Catalog) (*Result, error) - Cleanup(context.Context, *catalogdv1alpha1.Catalog) error + Unpack(context.Context, *catalogdv1alpha1.ClusterCatalog) (*Result, error) + Cleanup(context.Context, *catalogdv1alpha1.ClusterCatalog) error } // Result conveys progress information about unpacking catalog content. @@ -85,7 +85,7 @@ func NewUnpacker(sources map[catalogdv1alpha1.SourceType]Unpacker) Unpacker { return &unpacker{sources: sources} } -func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1alpha1.Catalog) (*Result, error) { +func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) (*Result, error) { source, ok := s.sources[catalog.Spec.Source.Type] if !ok { return nil, fmt.Errorf("source type %q not supported", catalog.Spec.Source.Type) @@ -95,7 +95,7 @@ func (s *unpacker) Unpack(ctx context.Context, catalog *catalogdv1alpha1.Catalog // TODO: Generalize the cleanup logic for the Unpacker so that cleanup // logic isn't specific to individual source types. -func (s *unpacker) Cleanup(ctx context.Context, catalog *catalogdv1alpha1.Catalog) error { +func (s *unpacker) Cleanup(ctx context.Context, catalog *catalogdv1alpha1.ClusterCatalog) error { source, ok := s.sources[catalog.Spec.Source.Type] if !ok { return fmt.Errorf("source type %q not supported", catalog.Spec.Source.Type) diff --git a/pkg/controllers/core/catalog_controller.go b/pkg/controllers/core/clustercatalog_controller.go similarity index 86% rename from pkg/controllers/core/catalog_controller.go rename to pkg/controllers/core/clustercatalog_controller.go index 6eea3f45..2b86d92c 100644 --- a/pkg/controllers/core/catalog_controller.go +++ b/pkg/controllers/core/clustercatalog_controller.go @@ -46,16 +46,16 @@ const ( requeueJitterMaxFactor = 0.01 ) -// CatalogReconciler reconciles a Catalog object -type CatalogReconciler struct { +// ClusterCatalogReconciler reconciles a Catalog object +type ClusterCatalogReconciler struct { client.Client Unpacker source.Unpacker Storage storage.Instance } -//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogs,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogs/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogs/finalizers,verbs=update +//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=clustercatalogs,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=clustercatalogs/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=clustercatalogs/finalizers,verbs=update //+kubebuilder:rbac:groups=core,resources=pods,verbs=create;update;patch;delete;get;list;watch //+kubebuilder:rbac:groups=core,resources=pods/log,verbs=get;list;watch //+kubebuilder:rbac:groups=core,namespace=system,resources=secrets,verbs=get; @@ -65,11 +65,11 @@ type CatalogReconciler struct { // // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile -func (r *CatalogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *ClusterCatalogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { // TODO: Where and when should we be logging errors and at which level? _ = log.FromContext(ctx).WithName("catalogd-controller") - existingCatsrc := v1alpha1.Catalog{} + existingCatsrc := v1alpha1.ClusterCatalog{} if err := r.Client.Get(ctx, req.NamespacedName, &existingCatsrc); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -92,7 +92,7 @@ func (r *CatalogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct return res, apimacherrors.NewAggregate([]error{reconcileErr, updateErr}) } } - existingCatsrc.Status, reconciledCatsrc.Status = v1alpha1.CatalogStatus{}, v1alpha1.CatalogStatus{} + existingCatsrc.Status, reconciledCatsrc.Status = v1alpha1.ClusterCatalogStatus{}, v1alpha1.ClusterCatalogStatus{} if !equality.Semantic.DeepEqual(existingCatsrc, reconciledCatsrc) { if updateErr := r.Client.Update(ctx, reconciledCatsrc); updateErr != nil { return res, apimacherrors.NewAggregate([]error{reconcileErr, updateErr}) @@ -102,9 +102,9 @@ func (r *CatalogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct } // SetupWithManager sets up the controller with the Manager. -func (r *CatalogReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *ClusterCatalogReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&v1alpha1.Catalog{}). + For(&v1alpha1.ClusterCatalog{}). Owns(&corev1.Pod{}). Complete(r) } @@ -117,7 +117,7 @@ func (r *CatalogReconciler) SetupWithManager(mgr ctrl.Manager) error { // to add the ctrl.Result type back as a return value. Adding a comment to ignore // linting from the linter that was fussing about this. // nolint:unparam -func (r *CatalogReconciler) reconcile(ctx context.Context, catalog *v1alpha1.Catalog) (ctrl.Result, error) { +func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1alpha1.ClusterCatalog) (ctrl.Result, error) { if catalog.DeletionTimestamp.IsZero() && !controllerutil.ContainsFinalizer(catalog, fbcDeletionFinalizer) { controllerutil.AddFinalizer(catalog, fbcDeletionFinalizer) return ctrl.Result{}, nil @@ -178,7 +178,7 @@ func (r *CatalogReconciler) reconcile(ctx context.Context, catalog *v1alpha1.Cat } } -func updateStatusUnpackPending(status *v1alpha1.CatalogStatus, result *source.Result) { +func updateStatusUnpackPending(status *v1alpha1.ClusterCatalogStatus, result *source.Result) { status.ResolvedSource = nil status.Phase = v1alpha1.PhasePending meta.SetStatusCondition(&status.Conditions, metav1.Condition{ @@ -189,7 +189,7 @@ func updateStatusUnpackPending(status *v1alpha1.CatalogStatus, result *source.Re }) } -func updateStatusUnpacking(status *v1alpha1.CatalogStatus, result *source.Result) { +func updateStatusUnpacking(status *v1alpha1.ClusterCatalogStatus, result *source.Result) { status.ResolvedSource = nil status.Phase = v1alpha1.PhaseUnpacking meta.SetStatusCondition(&status.Conditions, metav1.Condition{ @@ -200,7 +200,7 @@ func updateStatusUnpacking(status *v1alpha1.CatalogStatus, result *source.Result }) } -func updateStatusUnpacked(status *v1alpha1.CatalogStatus, result *source.Result, contentURL string, generation int64) { +func updateStatusUnpacked(status *v1alpha1.ClusterCatalogStatus, result *source.Result, contentURL string, generation int64) { status.ResolvedSource = result.ResolvedSource status.ContentURL = contentURL status.Phase = v1alpha1.PhaseUnpacked @@ -213,7 +213,7 @@ func updateStatusUnpacked(status *v1alpha1.CatalogStatus, result *source.Result, }) } -func updateStatusUnpackFailing(status *v1alpha1.CatalogStatus, err error) error { +func updateStatusUnpackFailing(status *v1alpha1.ClusterCatalogStatus, err error) error { status.ResolvedSource = nil status.Phase = v1alpha1.PhaseFailing meta.SetStatusCondition(&status.Conditions, metav1.Condition{ @@ -225,7 +225,7 @@ func updateStatusUnpackFailing(status *v1alpha1.CatalogStatus, err error) error return err } -func updateStatusStorageError(status *v1alpha1.CatalogStatus, err error) error { +func updateStatusStorageError(status *v1alpha1.ClusterCatalogStatus, err error) error { status.ResolvedSource = nil status.Phase = v1alpha1.PhaseFailing meta.SetStatusCondition(&status.Conditions, metav1.Condition{ @@ -237,7 +237,7 @@ func updateStatusStorageError(status *v1alpha1.CatalogStatus, err error) error { return err } -func updateStatusStorageDeleteError(status *v1alpha1.CatalogStatus, err error) error { +func updateStatusStorageDeleteError(status *v1alpha1.ClusterCatalogStatus, err error) error { meta.SetStatusCondition(&status.Conditions, metav1.Condition{ Type: v1alpha1.TypeDelete, Status: metav1.ConditionFalse, @@ -247,7 +247,7 @@ func updateStatusStorageDeleteError(status *v1alpha1.CatalogStatus, err error) e return err } -func unpackAgain(catalog *v1alpha1.Catalog) bool { +func unpackAgain(catalog *v1alpha1.ClusterCatalog) bool { // if the spec.Source.Image.Ref was changed, unpack the new ref if catalog.Spec.Source.Image.Ref != catalog.Status.ResolvedSource.Image.Ref { return true diff --git a/pkg/controllers/core/catalog_controller_test.go b/pkg/controllers/core/clustercatalog_controller_test.go similarity index 81% rename from pkg/controllers/core/catalog_controller_test.go rename to pkg/controllers/core/clustercatalog_controller_test.go index 876a540c..5e45e881 100644 --- a/pkg/controllers/core/catalog_controller_test.go +++ b/pkg/controllers/core/clustercatalog_controller_test.go @@ -31,7 +31,7 @@ type MockSource struct { shouldError bool } -func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1alpha1.Catalog) (*source.Result, error) { +func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1alpha1.ClusterCatalog) (*source.Result, error) { if ms.shouldError { return nil, errors.New("mocksource error") } @@ -39,7 +39,7 @@ func (ms *MockSource) Unpack(_ context.Context, _ *catalogdv1alpha1.Catalog) (*s return ms.result, nil } -func (ms *MockSource) Cleanup(_ context.Context, _ *catalogdv1alpha1.Catalog) error { +func (ms *MockSource) Cleanup(_ context.Context, _ *catalogdv1alpha1.ClusterCatalog) error { if ms.shouldError { return errors.New("mocksource error") } @@ -78,9 +78,9 @@ func (m MockStore) StorageServerHandler() http.Handler { func TestCatalogdControllerReconcile(t *testing.T) { for _, tt := range []struct { name string - catalog *catalogdv1alpha1.Catalog + catalog *catalogdv1alpha1.ClusterCatalog shouldErr bool - expectedCatalog *catalogdv1alpha1.Catalog + expectedCatalog *catalogdv1alpha1.ClusterCatalog source source.Unpacker store storage.Instance }{ @@ -88,29 +88,29 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "invalid source type, returns error", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "invalid", }, }, }, shouldErr: true, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "invalid", }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseFailing, Conditions: []metav1.Condition{ { @@ -128,12 +128,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: source.StatePending}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -142,12 +142,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -155,7 +155,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhasePending, Conditions: []metav1.Condition{ { @@ -173,12 +173,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: source.StateUnpacking}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -187,12 +187,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -200,7 +200,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacking, Conditions: []metav1.Condition{ { @@ -219,12 +219,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { result: &source.Result{State: "unknown"}, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -233,12 +233,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -246,7 +246,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseFailing, Conditions: []metav1.Condition{ { @@ -265,12 +265,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { shouldError: true, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -279,12 +279,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -292,7 +292,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseFailing, Conditions: []metav1.Condition{ { @@ -313,12 +313,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -327,12 +327,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -340,7 +340,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacked, ContentURL: "URL", Conditions: []metav1.Condition{ @@ -365,12 +365,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { store: &MockStore{ shouldError: true, }, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -379,12 +379,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -392,7 +392,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseFailing, Conditions: []metav1.Condition{ { @@ -408,11 +408,11 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "storage finalizer not set, storage finalizer gets set", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -421,12 +421,12 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -440,13 +440,13 @@ func TestCatalogdControllerReconcile(t *testing.T) { name: "storage finalizer set, catalog deletion timestamp is not zero (or nil), finalizer removed", source: &MockSource{}, store: &MockStore{}, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -455,13 +455,13 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -478,13 +478,13 @@ func TestCatalogdControllerReconcile(t *testing.T) { store: &MockStore{ shouldError: true, }, - catalog: &catalogdv1alpha1.Catalog{ + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -493,13 +493,13 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - expectedCatalog: &catalogdv1alpha1.Catalog{ + expectedCatalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "catalog", Finalizers: []string{fbcDeletionFinalizer}, DeletionTimestamp: &metav1.Time{Time: time.Date(2023, time.October, 10, 4, 19, 0, 0, time.UTC)}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -507,7 +507,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Conditions: []metav1.Condition{ { Type: catalogdv1alpha1.TypeDelete, @@ -520,7 +520,7 @@ func TestCatalogdControllerReconcile(t *testing.T) { }, } { t.Run(tt.name, func(t *testing.T) { - reconciler := &CatalogReconciler{ + reconciler := &ClusterCatalogReconciler{ Client: nil, Unpacker: source.NewUnpacker( map[catalogdv1alpha1.SourceType]source.Unpacker{ @@ -546,16 +546,16 @@ func TestCatalogdControllerReconcile(t *testing.T) { func TestPollingRequeue(t *testing.T) { for name, tc := range map[string]struct { - catalog *catalogdv1alpha1.Catalog + catalog *catalogdv1alpha1.ClusterCatalog expectedRequeueAfter time.Duration }{ - "Catalog with tag based image ref without any poll interval specified, requeueAfter set to 0, ie polling disabled": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog with tag based image ref without any poll interval specified, requeueAfter set to 0, ie polling disabled": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -566,13 +566,13 @@ func TestPollingRequeue(t *testing.T) { }, expectedRequeueAfter: time.Second * 0, }, - "Catalog with tag based image ref with poll interval specified, requeueAfter set to wait.jitter(pollInterval)": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog with tag based image ref with poll interval specified, requeueAfter set to wait.jitter(pollInterval)": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -586,7 +586,7 @@ func TestPollingRequeue(t *testing.T) { }, } { t.Run(name, func(t *testing.T) { - reconciler := &CatalogReconciler{ + reconciler := &ClusterCatalogReconciler{ Client: nil, Unpacker: source.NewUnpacker( map[catalogdv1alpha1.SourceType]source.Unpacker{ @@ -609,16 +609,16 @@ func TestPollingRequeue(t *testing.T) { func TestPollingReconcilerUnpack(t *testing.T) { for name, tc := range map[string]struct { - catalog *catalogdv1alpha1.Catalog + catalog *catalogdv1alpha1.ClusterCatalog expectedUnpackRun bool }{ - "catalog being resolved the first time, unpack should run": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog being resolved the first time, unpack should run": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -630,14 +630,14 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, expectedUnpackRun: true, }, - "catalog not being resolved the first time, no pollInterval mentioned, unpack should not run": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog not being resolved the first time, no pollInterval mentioned, unpack should not run": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -645,7 +645,7 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacked, ContentURL: "URL", Conditions: []metav1.Condition{ @@ -668,14 +668,14 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, expectedUnpackRun: false, }, - "catalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, unpack should not run": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, unpack should not run": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -684,7 +684,7 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacked, ContentURL: "URL", Conditions: []metav1.Condition{ @@ -707,14 +707,14 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, expectedUnpackRun: false, }, - "catalog not being resolved the first time, pollInterval mentioned, \"now\" is after next expected poll time, unpack should run": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is after next expected poll time, unpack should run": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 2, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -723,7 +723,7 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacked, ContentURL: "URL", Conditions: []metav1.Condition{ @@ -746,14 +746,14 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, expectedUnpackRun: true, }, - "catalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, spec.image changed, unpack should run": { - catalog: &catalogdv1alpha1.Catalog{ + "ClusterCatalog not being resolved the first time, pollInterval mentioned, \"now\" is before next expected poll time, spec.image changed, unpack should run": { + catalog: &catalogdv1alpha1.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: "test-catalog", Finalizers: []string{fbcDeletionFinalizer}, Generation: 3, }, - Spec: catalogdv1alpha1.CatalogSpec{ + Spec: catalogdv1alpha1.ClusterCatalogSpec{ Source: catalogdv1alpha1.CatalogSource{ Type: "image", Image: &catalogdv1alpha1.ImageSource{ @@ -762,7 +762,7 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, }, }, - Status: catalogdv1alpha1.CatalogStatus{ + Status: catalogdv1alpha1.ClusterCatalogStatus{ Phase: catalogdv1alpha1.PhaseUnpacked, ContentURL: "URL", Conditions: []metav1.Condition{ @@ -787,7 +787,7 @@ func TestPollingReconcilerUnpack(t *testing.T) { }, } { t.Run(name, func(t *testing.T) { - reconciler := &CatalogReconciler{ + reconciler := &ClusterCatalogReconciler{ Client: nil, Unpacker: &MockSource{shouldError: true}, Storage: &MockStore{}, diff --git a/test/e2e/unpack_test.go b/test/e2e/unpack_test.go index 8ebbdc6b..62550543 100644 --- a/test/e2e/unpack_test.go +++ b/test/e2e/unpack_test.go @@ -39,21 +39,21 @@ func catalogImageRef() string { return "docker-registry.catalogd-e2e.svc:5000/test-catalog:e2e" } -var _ = Describe("Catalog Unpacking", func() { +var _ = Describe("ClusterCatalog Unpacking", func() { var ( ctx context.Context - catalog *catalogd.Catalog + catalog *catalogd.ClusterCatalog ) - When("A Catalog is created", func() { + When("A ClusterCatalog is created", func() { BeforeEach(func() { ctx = context.Background() var err error - catalog = &catalogd.Catalog{ + catalog = &catalogd.ClusterCatalog{ ObjectMeta: metav1.ObjectMeta{ Name: catalogName, }, - Spec: catalogd.CatalogSpec{ + Spec: catalogd.ClusterCatalogSpec{ Source: catalogd.CatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ImageSource{ @@ -69,7 +69,7 @@ var _ = Describe("Catalog Unpacking", func() { }) It("Successfully unpacks catalog contents", func() { - By("Ensuring Catalog has Status.Condition of Unpacked with a status == True") + By("Ensuring ClusterCatalog has Status.Condition of Unpacked with a status == True") Eventually(func(g Gomega) { err := c.Get(ctx, types.NamespacedName{Name: catalog.Name}, catalog) g.Expect(err).ToNot(HaveOccurred()) @@ -111,7 +111,7 @@ var _ = Describe("Catalog Unpacking", func() { AfterEach(func() { Expect(c.Delete(ctx, catalog)).To(Succeed()) Eventually(func(g Gomega) { - err = c.Get(ctx, types.NamespacedName{Name: catalog.Name}, &catalogd.Catalog{}) + err = c.Get(ctx, types.NamespacedName{Name: catalog.Name}, &catalogd.ClusterCatalog{}) g.Expect(errors.IsNotFound(err)).To(BeTrue()) }).Should(Succeed()) })