diff --git a/commitchecker.yaml b/commitchecker.yaml
index 6c777c470..56e419e7b 100644
--- a/commitchecker.yaml
+++ b/commitchecker.yaml
@@ -1,4 +1,4 @@
-expectedMergeBase: 8e0efaa757200f136f533b0b05b27ebc10686575
+expectedMergeBase: 30838799bbe2fd9bce61a359a291d653a1990c90
upstreamBranch: main
upstreamOrg: operator-framework
upstreamRepo: operator-controller
diff --git a/docs/api-reference/catalogd-api-reference.md b/docs/api-reference/catalogd-api-reference.md
index f29bd21d4..fa52fbc00 100644
--- a/docs/api-reference/catalogd-api-reference.md
+++ b/docs/api-reference/catalogd-api-reference.md
@@ -98,6 +98,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `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 numbers are also accepted.
When omitted, the default priority is 0. | 0 | |
+| `availability` _string_ | Availability is an optional field that allows users to define whether the ClusterCatalog is utilized by the operator-controller.
Allowed values are : ["Enabled", "Disabled"].
If set to "Enabled", the catalog will be used for updates, serving contents, and package installations.
If set to "Disabled", catalogd will stop serving the catalog and the cached data will be removed.
If unspecified, the default value is "Enabled" | Enabled | Enum: [Disabled Enabled]
|
#### ClusterCatalogStatus
diff --git a/docs/howto/catalog-queries.md b/docs/howto/catalog-queries.md
index 7a25863ec..4e6f260d7 100644
--- a/docs/howto/catalog-queries.md
+++ b/docs/howto/catalog-queries.md
@@ -15,7 +15,7 @@ curl -k https://localhost:8443/catalogs/operatorhubio/all.json |
Available packages in a catalog
:
``` terminal
-jq -s '.[] | select( .schema == "olm.package")
+jq -s '.[] | select( .schema == "olm.package")'
```
Packages that support `AllNamespaces` install mode and do not use webhooks
diff --git a/go.mod b/go.mod
index 7f50bd57f..ebd0d93b8 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.32.0
+ github.com/operator-framework/catalogd v0.33.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
@@ -179,7 +179,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/proglottis/gpgme v0.1.3 // indirect
- github.com/prometheus/client_golang v1.20.4 // indirect
+ github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
@@ -251,5 +251,3 @@ require (
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
-
-replace github.com/operator-framework/catalogd => github.com/openshift/operator-framework-catalogd v0.0.0-20241016150055-953b8f848c9f
diff --git a/go.sum b/go.sum
index 60bedf138..ae3144963 100644
--- a/go.sum
+++ b/go.sum
@@ -533,10 +533,10 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11 h1:eTNDkNRNV5lZvUbVM9Nop0lBcljSnA8rZX6yQPZ0ZnU=
github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11/go.mod h1:EmVJt97N+pfWFsli/ipXTBZqSG5F5KGQhm3c3IsGq1o=
-github.com/openshift/operator-framework-catalogd v0.0.0-20241016150055-953b8f848c9f h1:Sz/vgzXZVyH0tD/4qk88WWcn8suDYqEoccUedh+PMis=
-github.com/openshift/operator-framework-catalogd v0.0.0-20241016150055-953b8f848c9f/go.mod h1:FrFSCwRXr4aPslcXIv48dan5AdM37k/B9tK/RpdvZCU=
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.33.0 h1:hnLIFykO1FkjOAUFRPuYRIHQTE0oBF9jkGmWjKhxniQ=
+github.com/operator-framework/catalogd v0.33.0/go.mod h1:anZurjcFMBvbkuyqlJ98v9z+yjniPKqmhlyitk9DuBQ=
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=
@@ -569,8 +569,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
-github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
-github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
+github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
diff --git a/internal/resolve/catalog.go b/internal/resolve/catalog.go
index 0c9dac762..de210fe3c 100644
--- a/internal/resolve/catalog.go
+++ b/internal/resolve/catalog.go
@@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log"
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
"github.com/operator-framework/operator-registry/alpha/declcfg"
@@ -231,20 +232,37 @@ func isDeprecated(bundle declcfg.Bundle, deprecation *declcfg.Deprecation) bool
type CatalogWalkFunc func(context.Context, *catalogd.ClusterCatalog, *declcfg.DeclarativeConfig, error) error
-func CatalogWalker(listCatalogs func(context.Context, ...client.ListOption) ([]catalogd.ClusterCatalog, error), getPackage func(context.Context, *catalogd.ClusterCatalog, string) (*declcfg.DeclarativeConfig, error)) func(ctx context.Context, packageName string, f CatalogWalkFunc, catalogListOpts ...client.ListOption) error {
+func CatalogWalker(
+ listCatalogs func(context.Context, ...client.ListOption) ([]catalogd.ClusterCatalog, error),
+ getPackage func(context.Context, *catalogd.ClusterCatalog, string) (*declcfg.DeclarativeConfig, error),
+) func(ctx context.Context, packageName string, f CatalogWalkFunc, catalogListOpts ...client.ListOption) error {
return func(ctx context.Context, packageName string, f CatalogWalkFunc, catalogListOpts ...client.ListOption) error {
+ l := log.FromContext(ctx)
catalogs, err := listCatalogs(ctx, catalogListOpts...)
if err != nil {
return fmt.Errorf("error listing catalogs: %w", err)
}
+ // Remove disabled catalogs from consideration
+ catalogs = slices.DeleteFunc(catalogs, func(c catalogd.ClusterCatalog) bool {
+ if c.Spec.Availability == "Disabled" {
+ l.Info("excluding ClusterCatalog from resolution process since it is disabled", "catalog", c.Name)
+ return true
+ }
+ return false
+ })
+
for i := range catalogs {
cat := &catalogs[i]
+
+ // process enabled catalogs
fbc, fbcErr := getPackage(ctx, cat, packageName)
+
if walkErr := f(ctx, cat, fbc, fbcErr); walkErr != nil {
return walkErr
}
}
+
return nil
}
}
diff --git a/internal/resolve/catalog_test.go b/internal/resolve/catalog_test.go
index bce3b5778..4856efc7e 100644
--- a/internal/resolve/catalog_test.go
+++ b/internal/resolve/catalog_test.go
@@ -963,3 +963,75 @@ func TestMultipleChannels(t *testing.T) {
assert.Equal(t, bsemver.MustParse("2.0.0"), *gotVersion)
assert.Equal(t, ptr.To(packageDeprecation(pkgName)), gotDeprecation)
}
+
+func TestAllCatalogsDisabled(t *testing.T) {
+ pkgName := randPkg()
+ listCatalogs := func(ctx context.Context, options ...client.ListOption) ([]catalogd.ClusterCatalog, error) {
+ return []catalogd.ClusterCatalog{
+ {
+ Spec: catalogd.ClusterCatalogSpec{
+ Availability: "Disabled",
+ },
+ },
+ {
+ Spec: catalogd.ClusterCatalogSpec{
+ Availability: "Disabled",
+ },
+ },
+ }, nil
+ }
+
+ getPackage := func(ctx context.Context, cat *catalogd.ClusterCatalog, packageName string) (*declcfg.DeclarativeConfig, error) {
+ panic("getPackage should never be called when all catalogs are disabled")
+ }
+
+ r := CatalogResolver{
+ WalkCatalogsFunc: CatalogWalker(listCatalogs, getPackage),
+ }
+
+ ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided)
+ _, _, _, err := r.Resolve(context.Background(), ce, nil)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "no bundles found for package")
+}
+
+func TestSomeCatalogsDisabled(t *testing.T) {
+ pkgName := randPkg()
+ listCatalogs := func(ctx context.Context, options ...client.ListOption) ([]catalogd.ClusterCatalog, error) {
+ return []catalogd.ClusterCatalog{
+ {
+ ObjectMeta: metav1.ObjectMeta{
+ Name: "enabledCatalog",
+ },
+ Spec: catalogd.ClusterCatalogSpec{
+ Priority: 1, // Higher priority
+ Availability: "Enabled",
+ },
+ },
+ {
+ ObjectMeta: metav1.ObjectMeta{
+ Name: "disabledCatalog",
+ },
+ Spec: catalogd.ClusterCatalogSpec{
+ Priority: 0, // Lower priority (but disabled)
+ Availability: "Disabled",
+ },
+ },
+ }, nil
+ }
+
+ getPackage := func(ctx context.Context, cat *catalogd.ClusterCatalog, packageName string) (*declcfg.DeclarativeConfig, error) {
+ // Only enabled catalog should be processed
+ return genPackage(pkgName), nil
+ }
+
+ r := CatalogResolver{
+ WalkCatalogsFunc: CatalogWalker(listCatalogs, getPackage),
+ }
+
+ ce := buildFooClusterExtension(pkgName, []string{}, ">=1.0.0", ocv1alpha1.UpgradeConstraintPolicyCatalogProvided)
+ gotBundle, gotVersion, _, err := r.Resolve(context.Background(), ce, nil)
+ require.NoError(t, err)
+ require.NotNil(t, gotBundle)
+ require.Equal(t, bsemver.MustParse("3.0.0"), *gotVersion)
+}
diff --git a/requirements.txt b/requirements.txt
index 37932ccc4..b44b225be 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,7 +14,7 @@ markdown2==2.5.1
MarkupSafe==2.1.5
mergedeep==1.3.4
mkdocs==1.6.1
-mkdocs-material==9.5.40
+mkdocs-material==9.5.41
mkdocs-material-extensions==1.3.1
packaging==24.1
paginate==0.5.7
diff --git a/vendor/github.com/operator-framework/catalogd/api/core/v1alpha1/clustercatalog_types.go b/vendor/github.com/operator-framework/catalogd/api/core/v1alpha1/clustercatalog_types.go
index ecc884036..c33f3d50b 100644
--- a/vendor/github.com/operator-framework/catalogd/api/core/v1alpha1/clustercatalog_types.go
+++ b/vendor/github.com/operator-framework/catalogd/api/core/v1alpha1/clustercatalog_types.go
@@ -33,6 +33,7 @@ const (
// Serving reasons
ReasonAvailable = "Available"
ReasonUnavailable = "Unavailable"
+ ReasonDisabled = "Disabled"
// Progressing reasons
ReasonSucceeded = "Succeeded"
@@ -40,6 +41,9 @@ const (
ReasonBlocked = "Blocked"
MetadataNameLabel = "olm.operatorframework.io/metadata.name"
+
+ AvailabilityEnabled = "Enabled"
+ AvailabilityDisabled = "Disabled"
)
//+kubebuilder:object:root=true
@@ -92,6 +96,20 @@ type ClusterCatalogSpec struct {
// +kubebuilder:default:=0
// +optional
Priority int32 `json:"priority"`
+
+ // Availability is an optional field that allows users to define whether the ClusterCatalog is utilized by the operator-controller.
+ //
+ // Allowed values are : ["Enabled", "Disabled"].
+ // If set to "Enabled", the catalog will be used for updates, serving contents, and package installations.
+ //
+ // If set to "Disabled", catalogd will stop serving the catalog and the cached data will be removed.
+ //
+ // If unspecified, the default value is "Enabled"
+ //
+ // +kubebuilder:validation:Enum="Disabled";"Enabled"
+ // +kubebuilder:default="Enabled"
+ // +optional
+ Availability string `json:"availability,omitempty"`
}
// ClusterCatalogStatus defines the observed state of ClusterCatalog
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9887a8857..52e51da3f 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -814,7 +814,7 @@ github.com/operator-framework/api/pkg/validation
github.com/operator-framework/api/pkg/validation/errors
github.com/operator-framework/api/pkg/validation/interfaces
github.com/operator-framework/api/pkg/validation/internal
-# github.com/operator-framework/catalogd v0.32.0 => github.com/openshift/operator-framework-catalogd v0.0.0-20241016150055-953b8f848c9f
+# github.com/operator-framework/catalogd v0.33.0
## explicit; go 1.22.5
github.com/operator-framework/catalogd/api/core/v1alpha1
# github.com/operator-framework/helm-operator-plugins v0.5.0
@@ -858,7 +858,7 @@ github.com/pmezard/go-difflib/difflib
# github.com/proglottis/gpgme v0.1.3
## explicit; go 1.11
github.com/proglottis/gpgme
-# github.com/prometheus/client_golang v1.20.4
+# github.com/prometheus/client_golang v1.20.5
## explicit; go 1.20
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header
@@ -2103,4 +2103,3 @@ sigs.k8s.io/structured-merge-diff/v4/value
sigs.k8s.io/yaml
sigs.k8s.io/yaml/goyaml.v2
sigs.k8s.io/yaml/goyaml.v3
-# github.com/operator-framework/catalogd => github.com/openshift/operator-framework-catalogd v0.0.0-20241016150055-953b8f848c9f