Skip to content

Commit caab602

Browse files
address review comment about type validation
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
1 parent f1985dc commit caab602

7 files changed

Lines changed: 11 additions & 2 deletions

File tree

api/v1/clusterextension_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ type BundleMetadata struct {
486486
//
487487
// +optional
488488
// <opcon:experimental>
489+
// +kubebuilder:validation:MaxLength=20
489490
// +kubebuilder:validation:XValidation:rule="self.matches(\"^$|^(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\\\\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*$\")",message="release must be empty or consist of dot-separated identifiers (numeric without leading zeros, or alphanumeric)"
490491
Release *string `json:"release,omitempty"`
491492
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ _Appears in:_
6767
| --- | --- | --- | --- |
6868
| `name` _string_ | name is required and follows the DNS subdomain standard as defined in [RFC 1123].<br />It must contain only lowercase alphanumeric characters, hyphens (-) or periods (.),<br />start and end with an alphanumeric character, and be no longer than 253 characters. | | Required: \{\} <br /> |
6969
| `version` _string_ | version is required and references the version that this bundle represents.<br />It follows the semantic versioning standard as defined in https://semver.org/. | | Required: \{\} <br /> |
70-
| `release` _string_ | release is an optional field that identifies a specific release of this bundle's version.<br />A release represents a re-publication of the same version, typically used to deliver<br />packaging or metadata changes without changing the version number. When multiple<br />releases exist for the same version, higher releases are preferred. An unset release<br />is less preferred than all other release values.<br />The value consists of dot-separated identifiers, where each identifier is either a<br />numeric value (without leading zeros) or an alphanumeric string (e.g., "2", "1.el9",<br />"3.alpha.1"). Releases are compared identifier by identifier: numeric identifiers are<br />compared as integers, alphanumeric identifiers are compared lexically, and numeric<br />identifiers always sort before alphanumeric identifiers.<br />For bundles with explicit pkg.Release metadata, this field contains that release value.<br />For registry+v1 bundles lacking an explicit release value, this field contains the release<br />extracted from version's build metadata (e.g., '2' from '1.0.0+2').<br />This field is omitted when the bundle's release value is unset.<br /><opcon:experimental> | | Optional: \{\} <br /> |
70+
| `release` _string_ | release is an optional field that identifies a specific release of this bundle's version.<br />A release represents a re-publication of the same version, typically used to deliver<br />packaging or metadata changes without changing the version number. When multiple<br />releases exist for the same version, higher releases are preferred. An unset release<br />is less preferred than all other release values.<br />The value consists of dot-separated identifiers, where each identifier is either a<br />numeric value (without leading zeros) or an alphanumeric string (e.g., "2", "1.el9",<br />"3.alpha.1"). Releases are compared identifier by identifier: numeric identifiers are<br />compared as integers, alphanumeric identifiers are compared lexically, and numeric<br />identifiers always sort before alphanumeric identifiers.<br />For bundles with explicit pkg.Release metadata, this field contains that release value.<br />For registry+v1 bundles lacking an explicit release value, this field contains the release<br />extracted from version's build metadata (e.g., '2' from '1.0.0+2').<br />This field is omitted when the bundle's release value is unset.<br /><opcon:experimental> | | MaxLength: 20 <br />Optional: \{\} <br /> |
7171

7272

7373
#### CRDUpgradeSafetyEnforcement

helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ spec:
706706
For registry+v1 bundles lacking an explicit release value, this field contains the release
707707
extracted from version's build metadata (e.g., '2' from '1.0.0+2').
708708
This field is omitted when the bundle's release value is unset.
709+
maxLength: 20
709710
type: string
710711
x-kubernetes-validations:
711712
- message: release must be empty or consist of dot-separated

internal/operator-controller/applier/boxcutter.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func (r *SimpleRevisionGenerator) GenerateRevisionFromHelmRelease(
8585
if v := helmRelease.Labels[labels.BundleVersionKey]; v != "" {
8686
annotationUpdates[labels.BundleVersionKey] = v
8787
}
88+
if v := helmRelease.Labels[labels.BundleReleaseKey]; v != "" {
89+
annotationUpdates[labels.BundleReleaseKey] = v
90+
}
8891
if v := helmRelease.Labels[labels.PackageNameKey]; v != "" {
8992
annotationUpdates[labels.PackageNameKey] = v
9093
}
@@ -100,6 +103,7 @@ func (r *SimpleRevisionGenerator) GenerateRevisionFromHelmRelease(
100103
labels.BundleNameKey: helmRelease.Labels[labels.BundleNameKey],
101104
labels.PackageNameKey: helmRelease.Labels[labels.PackageNameKey],
102105
labels.BundleVersionKey: helmRelease.Labels[labels.BundleVersionKey],
106+
labels.BundleReleaseKey: helmRelease.Labels[labels.BundleReleaseKey],
103107
labels.BundleReferenceKey: helmRelease.Labels[labels.BundleReferenceKey],
104108
})
105109
rev.WithName(fmt.Sprintf("%s-1", ext.Name))

internal/operator-controller/labels/labels.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const (
3232
// across supported metadata backends, including Helm release labels and
3333
// ClusterObjectSet annotations. For bundles with explicit pkg.Release metadata,
3434
// this field contains that release value. For registry+v1 bundles, this field contains
35-
// the release extracted from version's build metadata (e.g., '2' from '1.0.0+2').
35+
// a release derived from the version's build metadata only when that metadata is
36+
// parseable as a release value (e.g., '2' from '1.0.0+2').
3637
BundleReleaseKey = "olm.operatorframework.io/bundle-release"
3738

3839
// BundleReferenceKey is the label key used to record an external reference

manifests/experimental-e2e.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ spec:
13181318
For registry+v1 bundles lacking an explicit release value, this field contains the release
13191319
extracted from version's build metadata (e.g., '2' from '1.0.0+2').
13201320
This field is omitted when the bundle's release value is unset.
1321+
maxLength: 20
13211322
type: string
13221323
x-kubernetes-validations:
13231324
- message: release must be empty or consist of dot-separated

manifests/experimental.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,7 @@ spec:
12791279
For registry+v1 bundles lacking an explicit release value, this field contains the release
12801280
extracted from version's build metadata (e.g., '2' from '1.0.0+2').
12811281
This field is omitted when the bundle's release value is unset.
1282+
maxLength: 20
12821283
type: string
12831284
x-kubernetes-validations:
12841285
- message: release must be empty or consist of dot-separated

0 commit comments

Comments
 (0)