From 81576f582c300ab331fc6ebefcd9ff50870d9093 Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Wed, 2 Oct 2024 21:02:35 -0400 Subject: [PATCH] bump catalogd to v0.30.0 Signed-off-by: Joe Lanford --- README.md | 2 +- config/samples/catalogd_operatorcatalog.yaml | 2 +- docs/Tasks/adding-a-catalog.md | 4 ++-- docs/drafts/controlling-catalog-selection.md | 6 ++--- docs/refs/api/catalogd-api-reference.md | 23 +++++++++---------- go.mod | 4 ++-- go.sum | 8 +++---- hack/test/pre-upgrade-setup.sh | 2 +- internal/catalogmetadata/cache/cache.go | 6 ++--- internal/catalogmetadata/cache/cache_test.go | 14 +++++------ .../clusterextension_controller.go | 2 +- 11 files changed, 36 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index c4a1ce3af..8e10dfc90 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ metadata: name: operatorhubio spec: source: - type: image + type: Image image: ref: quay.io/operatorhubio/catalog:latest pollInterval: 10m diff --git a/config/samples/catalogd_operatorcatalog.yaml b/config/samples/catalogd_operatorcatalog.yaml index 5965edeb1..48f1da573 100644 --- a/config/samples/catalogd_operatorcatalog.yaml +++ b/config/samples/catalogd_operatorcatalog.yaml @@ -4,7 +4,7 @@ metadata: name: operatorhubio spec: source: - type: image + type: Image image: ref: quay.io/operatorhubio/catalog:latest pollInterval: 10m diff --git a/docs/Tasks/adding-a-catalog.md b/docs/Tasks/adding-a-catalog.md index 8158f0d4a..8fc226b90 100644 --- a/docs/Tasks/adding-a-catalog.md +++ b/docs/Tasks/adding-a-catalog.md @@ -27,7 +27,7 @@ This catalog is distributed as an image [quay.io/operatorhubio/catalog](https:// name: operatorhubio spec: source: - type: image + type: Image image: ref: pollInterval: @@ -49,7 +49,7 @@ This catalog is distributed as an image [quay.io/operatorhubio/catalog](https:// name: operatorhub spec: source: - type: image + type: Image image: ref: quay.io/operatorhubio/catalog:latest pollInterval: 1h diff --git a/docs/drafts/controlling-catalog-selection.md b/docs/drafts/controlling-catalog-selection.md index e91a1eb0f..647f84107 100644 --- a/docs/drafts/controlling-catalog-selection.md +++ b/docs/drafts/controlling-catalog-selection.md @@ -132,7 +132,7 @@ metadata: spec: priority: 1000 source: - type: image + type: Image image: ref: quay.io/example/high-priority-catalog:latest ``` @@ -169,7 +169,7 @@ If the system cannot resolve to a single bundle due to ambiguity, it will genera spec: priority: 1000 source: - type: image + type: Image image: ref: quay.io/example/catalog-a:latest ``` @@ -184,7 +184,7 @@ If the system cannot resolve to a single bundle due to ambiguity, it will genera spec: priority: 500 source: - type: image + type: Image image: ref: quay.io/example/catalog-b:latest ``` diff --git a/docs/refs/api/catalogd-api-reference.md b/docs/refs/api/catalogd-api-reference.md index 07be6f3c6..80a4b327d 100644 --- a/docs/refs/api/catalogd-api-reference.md +++ b/docs/refs/api/catalogd-api-reference.md @@ -27,6 +27,7 @@ Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group CatalogSource is a discriminated union of possible sources for a Catalog. +CatalogSource contains the sourcing information for a Catalog @@ -35,8 +36,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `type` _[SourceType](#sourcetype)_ | type is a required reference to the type of source the catalog is sourced from.

Allowed values are ["image"]

When this field is set to "image", the ClusterCatalog content will be sourced from an OCI image.
When using an image source, the image field must be set and must be the only field defined for this type. | | Enum: [image]
Required: \{\}
| -| `image` _[ImageSource](#imagesource)_ | image is used to configure how catalog contents are sourced from an OCI image. This field must be set when type is set to "image" and must be the only field defined for this type. | | | +| `type` _[SourceType](#sourcetype)_ | type is a required reference to the type of source the catalog is sourced from.

Allowed values are ["Image"]

When this field is set to "Image", the ClusterCatalog content will be sourced from an OCI image.
When using an image source, the image field must be set and must be the only field defined for this type. | | Enum: [Image]
Required: \{\}
| +| `image` _[ImageSource](#imagesource)_ | image is used to configure how catalog contents are sourced from an OCI image. This field must be set when type is set to "Image" and must be the only field defined for this type. | | | #### ClusterCatalog @@ -95,7 +96,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `source` _[CatalogSource](#catalogsource)_ | source is a required field that allows the user to define the source of a Catalog that contains catalog metadata in the File-Based Catalog (FBC) format.

Below is a minimal example of a ClusterCatalogSpec that sources a catalog from an image:

source:
type: image
image:
ref: quay.io/operatorhubio/catalog:latest

For more information on FBC, see https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs | | | +| `source` _[CatalogSource](#catalogsource)_ | source is a required field that allows the user to define the source of a Catalog that contains catalog metadata in the File-Based Catalog (FBC) format.

Below is a minimal example of a ClusterCatalogSpec that sources a catalog from an image:

source:
type: Image
image:
ref: quay.io/operatorhubio/catalog:latest

For more information on FBC, see https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs | | | | `priority` _integer_ | priority is an optional field that allows the user to define a priority for a ClusterCatalog.
A ClusterCatalog's priority is used by clients as a tie-breaker between ClusterCatalogs that meet the client's requirements.
For example, in the case where multiple ClusterCatalogs provide the same bundle.
A higher number means higher priority. Negative number as also accepted.
When omitted, the default priority is 0. | 0 | | @@ -113,10 +114,9 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions is a representation of the current state for this ClusterCatalog.
The status is represented by a set of "conditions".

Each condition is generally structured in the following format:
- Type: a string representation of the condition type. More or less the condition "name".
- Status: a string representation of the state of the condition. Can be one of ["True", "False", "Unknown"].
- Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations.
- Message: a human-readable message that further elaborates on the state of the condition.

The current set of condition types are:
- "Unpacked", epresents whether, or not, the catalog contents have been successfully unpacked.
- "Deleted", represents whether, or not, the catalog contents have been successfully deleted.

The current set of reasons are:
- "UnpackPending", this reason is set on the "Unpack" condition when unpacking the catalog has not started.
- "Unpacking", this reason is set on the "Unpack" condition when the catalog is being unpacked.
- "UnpackSuccessful", this reason is set on the "Unpack" condition when unpacking the catalog is successful and the catalog metadata is available to the cluster.
- "FailedToStore", this reason is set on the "Unpack" condition when an error has been encountered while storing the contents of the catalog.
- "FailedToDelete", this reason is set on the "Delete" condition when an error has been encountered while deleting the contents of the catalog. | | | -| `resolvedSource` _[ResolvedCatalogSource](#resolvedcatalogsource)_ | resolvedSource contains information about the resolved source based on the source type.

Below is an example of a resolved source for an image source:
resolvedSource:

image:
lastPollAttempt: "2024-09-10T12:22:13Z"
lastUnpacked: "2024-09-10T12:22:13Z"
ref: quay.io/operatorhubio/catalog:latest
resolvedRef: quay.io/operatorhubio/catalog@sha256:c7392b4be033da629f9d665fec30f6901de51ce3adebeff0af579f311ee5cf1b
type: image | | | +| `resolvedSource` _[ResolvedCatalogSource](#resolvedcatalogsource)_ | resolvedSource contains information about the resolved source based on the source type.

Below is an example of a resolved source for an image source:
resolvedSource:

image:
lastPollAttempt: "2024-09-10T12:22:13Z"
lastUnpacked: "2024-09-10T12:22:13Z"
ref: quay.io/operatorhubio/catalog:latest
resolvedRef: quay.io/operatorhubio/catalog@sha256:c7392b4be033da629f9d665fec30f6901de51ce3adebeff0af579f311ee5cf1b
type: Image | | | | `contentURL` _string_ | contentURL is a cluster-internal URL from which on-cluster components
can read the content of a catalog | | | -| `observedGeneration` _integer_ | 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. | | | -| `lastUnpacked` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastUnpacked represents the time when the
ClusterCatalog object was last unpacked. | | | +| `lastUnpacked` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastUnpacked represents the time when the
ClusterCatalog object was last unpacked successfully. | | | #### ImageSource @@ -141,6 +141,7 @@ _Appears in:_ ResolvedCatalogSource is a discriminated union of resolution information for a Catalog. +ResolvedCatalogSource contains the information about a sourced Catalog @@ -149,7 +150,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `type` _[SourceType](#sourcetype)_ | type is a reference to the type of source the catalog is sourced from.

It will be set to one of the following values: ["image"].

When this field is set to "image", information about the resolved image source will be set in the 'image' field. | | Enum: [image]
Required: \{\}
| +| `type` _[SourceType](#sourcetype)_ | type is a reference to the type of source the catalog is sourced from.

It will be set to one of the following values: ["Image"].

When this field is set to "Image", information about the resolved image source will be set in the 'image' field. | | Enum: [Image]
Required: \{\}
| | `image` _[ResolvedImageSource](#resolvedimagesource)_ | image is a field containing resolution information for a catalog sourced from an image. | | | @@ -166,10 +167,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `ref` _string_ | ref is the reference to a container image containing Catalog contents. | | | -| `resolvedRef` _string_ | resolvedRef is the resolved sha256 image ref containing Catalog contents. | | | -| `lastPollAttempt` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastPollAttempt is the time when the source image was last polled for new content. | | | -| `lastUnpacked` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastUnpacked is the last time when the Catalog contents were successfully unpacked. | | | +| `ref` _string_ | ref contains the resolved sha256 image ref containing Catalog contents. | | | +| `lastSuccessfulPollAttempt` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | lastSuccessfulPollAttempt is the time when the resolved source was last successfully polled for new content. | | | #### SourceType @@ -186,6 +185,6 @@ _Appears in:_ | Field | Description | | --- | --- | -| `image` | | +| `Image` | | diff --git a/go.mod b/go.mod index 2af8e39b3..bf049d9d9 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/onsi/gomega v1.34.2 github.com/opencontainers/go-digest v1.0.0 github.com/operator-framework/api v0.27.0 - github.com/operator-framework/catalogd v0.29.0 + github.com/operator-framework/catalogd v0.30.0 github.com/operator-framework/helm-operator-plugins v0.5.0 github.com/operator-framework/operator-registry v1.47.0 github.com/spf13/pflag v1.0.5 @@ -139,7 +139,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/k14s/starlark-go v0.0.0-20200720175618-3a5c849cc368 // indirect github.com/k14s/ytt v0.36.0 // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.10 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect diff --git a/go.sum b/go.sum index adce30d7c..4d792213c 100644 --- a/go.sum +++ b/go.sum @@ -412,8 +412,8 @@ github.com/k14s/ytt v0.36.0/go.mod h1:awQ3bHBk1qT2Xn3GJVdmaLss2khZOIBBKFd2TNXZNM github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -535,8 +535,8 @@ github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11 h1:eT github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11/go.mod h1:EmVJt97N+pfWFsli/ipXTBZqSG5F5KGQhm3c3IsGq1o= github.com/operator-framework/api v0.27.0 h1:OrVaGKZJvbZo58HTv2guz7aURkhVKYhFqZ/6VpifiXI= github.com/operator-framework/api v0.27.0/go.mod h1:lg2Xx+S8NQWGYlEOvFwQvH46E5EK5IrAIL7HWfAhciM= -github.com/operator-framework/catalogd v0.29.0 h1:GpeBGUWNGbVTH9l2S4RLi2wRvLAguG/4LYdxqfrwlak= -github.com/operator-framework/catalogd v0.29.0/go.mod h1:cikCg3BwFMyMrRhMXN6cxpv03Cm/EMV3rHX5yi2w8vo= +github.com/operator-framework/catalogd v0.30.0 h1:uW5fGZ5vJlUy9n26B13WZLjc3OMrvr2gM4FQDStUd2Y= +github.com/operator-framework/catalogd v0.30.0/go.mod h1:mSyAemlhvngQPylBU1nY/57syccOv1u9biyovhlRe08= github.com/operator-framework/helm-operator-plugins v0.5.0 h1:qph2OoECcI9mpuUBtOsWOMgvpx52mPTTSvzVxICsT04= github.com/operator-framework/helm-operator-plugins v0.5.0/go.mod h1:yVncrZ/FJNqedMil+055fk6sw8aMKRrget/AqGM0ig0= github.com/operator-framework/operator-lib v0.15.0 h1:0QeRM4PMtThqINpcFGCEBnIV3Z8u7/8fYLEx6mUtdcM= diff --git a/hack/test/pre-upgrade-setup.sh b/hack/test/pre-upgrade-setup.sh index 8eed4c81d..e2328f118 100755 --- a/hack/test/pre-upgrade-setup.sh +++ b/hack/test/pre-upgrade-setup.sh @@ -26,7 +26,7 @@ metadata: name: ${TEST_CLUSTER_CATALOG_NAME} spec: source: - type: image + type: Image image: ref: ${TEST_CATALOG_IMG} pollInterval: 24h diff --git a/internal/catalogmetadata/cache/cache.go b/internal/catalogmetadata/cache/cache.go index e986c9714..d003ae860 100644 --- a/internal/catalogmetadata/cache/cache.go +++ b/internal/catalogmetadata/cache/cache.go @@ -83,7 +83,7 @@ func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *c cacheDir := fsc.cacheDir(catalog.Name) fsc.mutex.RLock() if data, ok := fsc.cacheDataByCatalogName[catalog.Name]; ok { - if catalog.Status.ResolvedSource.Image.ResolvedRef == data.ResolvedRef { + if catalog.Status.ResolvedSource.Image.Ref == data.ResolvedRef { fsc.mutex.RUnlock() return os.DirFS(cacheDir), nil } @@ -119,7 +119,7 @@ func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *c // this to be the same value, skip the write logic and return // the cached contents if data, ok := fsc.cacheDataByCatalogName[catalog.Name]; ok { - if data.ResolvedRef == catalog.Status.ResolvedSource.Image.ResolvedRef { + if data.ResolvedRef == catalog.Status.ResolvedSource.Image.Ref { return os.DirFS(cacheDir), nil } } @@ -161,7 +161,7 @@ func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *c } fsc.cacheDataByCatalogName[catalog.Name] = cacheData{ - ResolvedRef: catalog.Status.ResolvedSource.Image.ResolvedRef, + ResolvedRef: catalog.Status.ResolvedSource.Image.Ref, } return os.DirFS(cacheDir), nil diff --git a/internal/catalogmetadata/cache/cache_test.go b/internal/catalogmetadata/cache/cache_test.go index 74f7d79c0..2198b9493 100644 --- a/internal/catalogmetadata/cache/cache_test.go +++ b/internal/catalogmetadata/cache/cache_test.go @@ -85,7 +85,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, @@ -103,7 +103,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, @@ -123,7 +123,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, @@ -143,7 +143,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, @@ -162,7 +162,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, @@ -231,7 +231,7 @@ func TestFilesystemCacheFetchCatalogContents(t *testing.T) { if tt.testCaching { if !tt.shouldHitCache { - tt.catalog.Status.ResolvedSource.Image.ResolvedRef = "fake/catalog@sha256:shafake" + tt.catalog.Status.ResolvedSource.Image.Ref = "fake/catalog@sha256:shafake" } tt.tripper.content["foobar/olm.package/foobar.json"] = &fstest.MapFile{Data: []byte(`{"schema": "olm.package", "name": "foobar"}`)} actualFS, err := c.FetchCatalogContents(ctx, tt.catalog) @@ -256,7 +256,7 @@ func TestFilesystemCacheRemove(t *testing.T) { ResolvedSource: &catalogd.ResolvedCatalogSource{ Type: catalogd.SourceTypeImage, Image: &catalogd.ResolvedImageSource{ - ResolvedRef: "fake/catalog@sha256:fakesha", + Ref: "fake/catalog@sha256:fakesha", }, }, }, diff --git a/internal/controllers/clusterextension_controller.go b/internal/controllers/clusterextension_controller.go index 65cb2eaf6..2601d97f0 100644 --- a/internal/controllers/clusterextension_controller.go +++ b/internal/controllers/clusterextension_controller.go @@ -416,7 +416,7 @@ func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error { if oldObject.Status.ResolvedSource != nil && newObject.Status.ResolvedSource != nil { if oldObject.Status.ResolvedSource.Image != nil && newObject.Status.ResolvedSource.Image != nil { - return oldObject.Status.ResolvedSource.Image.ResolvedRef != newObject.Status.ResolvedSource.Image.ResolvedRef + return oldObject.Status.ResolvedSource.Image.Ref != newObject.Status.ResolvedSource.Image.Ref } } return true