Skip to content

Commit b871e7e

Browse files
Fix ClusterCatalog Priority field validation markers (#2432)
Changes validation markers from lowercase to uppercase to ensure min/max constraints are properly generated in the CRD YAML. Changes: - +kubebuilder:validation:minimum -> +kubebuilder:validation:Minimum - +kubebuilder:validation:maximum -> +kubebuilder:validation:Maximum The lowercase markers (minimum/maximum) were not generating the validation constraints in the generated CRD. Using uppercase markers (Minimum/Maximum) ensures the CRD includes: minimum: -2147483648 maximum: 2147483647 This completes the validation for the Priority field and resolves the kubeapilinter:optionalfields warning about incomplete validation.
1 parent 5227a12 commit b871e7e

File tree

8 files changed

+15
-3
lines changed

8 files changed

+15
-3
lines changed

api/v1/clustercatalog_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ type ClusterCatalogSpec struct {
125125
// The highest possible value is 2147483647.
126126
//
127127
// +kubebuilder:default:=0
128-
// +kubebuilder:validation:minimum:=-2147483648
129-
// +kubebuilder:validation:maximum:=2147483647
128+
// +kubebuilder:validation:Minimum:=-2147483648
129+
// +kubebuilder:validation:Maximum:=2147483647
130130
// +optional
131131
Priority int32 `json:"priority"`
132132

docs/api-reference/olmv1-api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ _Appears in:_
178178
| Field | Description | Default | Validation |
179179
| --- | --- | --- | --- |
180180
| `source` _[CatalogSource](#catalogsource)_ | source is a required field that defines the source of a catalog.<br />A catalog contains information on content that can be installed on a cluster.<br />The catalog source makes catalog contents discoverable and usable by other on-cluster components.<br />These components can present the content in a GUI dashboard or install content from the catalog on the cluster.<br />The catalog source must contain catalog metadata in the File-Based Catalog (FBC) format.<br />For more information on FBC, see https://olm.operatorframework.io/docs/reference/file-based-catalogs/#docs.<br />Below is a minimal example of a ClusterCatalogSpec that sources a catalog from an image:<br /> source:<br /> type: Image<br /> image:<br /> ref: quay.io/operatorhubio/catalog:latest | | Required: \{\} <br /> |
181-
| `priority` _integer_ | priority is an optional field that defines a priority for this ClusterCatalog.<br />Clients use the ClusterCatalog priority as a tie-breaker between ClusterCatalogs that meet their requirements.<br />Higher numbers mean higher priority.<br />Clients decide how to handle scenarios where multiple ClusterCatalogs with the same priority meet their requirements.<br />Clients should prompt users for additional input to break the tie.<br />When omitted, the default priority is 0.<br />Use negative numbers to specify a priority lower than the default.<br />Use positive numbers to specify a priority higher than the default.<br />The lowest possible value is -2147483648.<br />The highest possible value is 2147483647. | 0 | |
181+
| `priority` _integer_ | priority is an optional field that defines a priority for this ClusterCatalog.<br />Clients use the ClusterCatalog priority as a tie-breaker between ClusterCatalogs that meet their requirements.<br />Higher numbers mean higher priority.<br />Clients decide how to handle scenarios where multiple ClusterCatalogs with the same priority meet their requirements.<br />Clients should prompt users for additional input to break the tie.<br />When omitted, the default priority is 0.<br />Use negative numbers to specify a priority lower than the default.<br />Use positive numbers to specify a priority higher than the default.<br />The lowest possible value is -2147483648.<br />The highest possible value is 2147483647. | 0 | Maximum: 2.147483647e+09 <br />Minimum: -2.147483648e+09 <br /> |
182182
| `availabilityMode` _[AvailabilityMode](#availabilitymode)_ | availabilityMode is an optional field that defines how the ClusterCatalog is made available to clients on the cluster.<br />Allowed values are "Available", "Unavailable", or omitted.<br />When omitted, the default value is "Available".<br />When set to "Available", the catalog contents are unpacked and served over the catalog content HTTP server.<br />Clients should consider this ClusterCatalog and its contents as usable.<br />When set to "Unavailable", the catalog contents are no longer served over the catalog content HTTP server.<br />Treat this the same as if the ClusterCatalog does not exist.<br />Use "Unavailable" when you want to keep the ClusterCatalog but treat it as if it doesn't exist. | Available | Enum: [Unavailable Available] <br /> |
183183

184184

helm/olmv1/base/catalogd/crd/experimental/olm.operatorframework.io_clustercatalogs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ spec:
9292
The lowest possible value is -2147483648.
9393
The highest possible value is 2147483647.
9494
format: int32
95+
maximum: 2147483647
96+
minimum: -2147483648
9597
type: integer
9698
source:
9799
description: |-

helm/olmv1/base/catalogd/crd/standard/olm.operatorframework.io_clustercatalogs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ spec:
9292
The lowest possible value is -2147483648.
9393
The highest possible value is 2147483647.
9494
format: int32
95+
maximum: 2147483647
96+
minimum: -2147483648
9597
type: integer
9698
source:
9799
description: |-

manifests/experimental-e2e.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ spec:
278278
The lowest possible value is -2147483648.
279279
The highest possible value is 2147483647.
280280
format: int32
281+
maximum: 2147483647
282+
minimum: -2147483648
281283
type: integer
282284
source:
283285
description: |-

manifests/experimental.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ spec:
239239
The lowest possible value is -2147483648.
240240
The highest possible value is 2147483647.
241241
format: int32
242+
maximum: 2147483647
243+
minimum: -2147483648
242244
type: integer
243245
source:
244246
description: |-

manifests/standard-e2e.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ spec:
278278
The lowest possible value is -2147483648.
279279
The highest possible value is 2147483647.
280280
format: int32
281+
maximum: 2147483647
282+
minimum: -2147483648
281283
type: integer
282284
source:
283285
description: |-

manifests/standard.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ spec:
239239
The lowest possible value is -2147483648.
240240
The highest possible value is 2147483647.
241241
format: int32
242+
maximum: 2147483647
243+
minimum: -2147483648
242244
type: integer
243245
source:
244246
description: |-

0 commit comments

Comments
 (0)