Skip to content

Commit

Permalink
rename Catalog to ClusterCatalog (#268)
Browse files Browse the repository at this point in the history
Signed-off-by: everettraven <everettraven@gmail.com>
  • Loading branch information
everettraven committed May 15, 2024
1 parent b68cda4 commit 4f1219c
Show file tree
Hide file tree
Showing 20 changed files with 241 additions and 241 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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*
Expand All @@ -43,7 +43,7 @@ Procedure steps marked with an asterisk (`*`) are likely to change with future A
Labels: <none>
Annotations: <none>
API Version: catalogd.operatorframework.io/v1alpha1
Kind: Catalog
Kind: ClusterCatalog
Metadata:
Creation Timestamp: 2023-06-23T18:35:13Z
Generation: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"`
}
Expand Down Expand Up @@ -145,5 +145,5 @@ type ImageSource struct {
}

func init() {
SchemeBuilder.Register(&Catalog{}, &CatalogList{})
SchemeBuilder.Register(&ClusterCatalog{}, &ClusterCatalogList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand Down
78 changes: 39 additions & 39 deletions api/core/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |-
Expand All @@ -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: |-
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config/base/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 4f1219c

Please sign in to comment.