🌱 consolidate Release types with operator-registry#2771
🌱 consolidate Release types with operator-registry#2771rashmigottipati wants to merge 3 commits into
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
This PR removes operator-controller’s duplicate bundle.Release / bundle.VersionRelease definitions and standardizes on declcfg.Release / declcfg.VersionRelease from operator-registry, keeping the API boundary (BundleMetadata.Release as *string) intact via conversion helpers.
Changes:
- Replaced internal
bundle.VersionReleaseusage across resolver, catalogmetadata filtering/comparison, and tests withdeclcfg.VersionRelease. - Moved legacy registry+v1 “release-in-build-metadata” parsing logic into package-local helpers where needed, and updated metadata conversion (
bundleutil.MetadataFor) accordingly. - Removed the now-redundant
internal/operator-controller/bundle/versionrelease.goand its unit tests; updated generated CRD artifacts touched by regeneration.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| manifests/experimental.yaml | Updates generated experimental manifests (includes CRD generator version annotation change for ClusterExtension CRD). |
| manifests/experimental-e2e.yaml | Updates generated experimental e2e manifests (includes CRD generator version annotation change for ClusterExtension CRD). |
| internal/operator-controller/resolve/resolver.go | Changes resolver interface to return *declcfg.VersionRelease instead of the internal type. |
| internal/operator-controller/resolve/catalog.go | Propagates declcfg.VersionRelease through catalog resolution return types. |
| internal/operator-controller/resolve/catalog_test.go | Updates resolver unit tests to assert against declcfg.VersionRelease. |
| internal/operator-controller/controllers/clusterextension_controller_test.go | Updates controller tests to use declcfg.VersionRelease in mocked resolver responses. |
| internal/operator-controller/catalogmetadata/filter/successors.go | Converts installed bundle metadata parsing to produce *declcfg.VersionRelease, including legacy registry+v1 parsing helper. |
| internal/operator-controller/catalogmetadata/filter/successors_test.go | Adjusts successor/filter tests to use declcfg.VersionRelease parsing helper. |
| internal/operator-controller/catalogmetadata/filter/bundle_predicates.go | Updates version/release predicate API to take declcfg.VersionRelease and compare via declcfg’s Compare semantics. |
| internal/operator-controller/catalogmetadata/compare/compare.go | Updates bundle version/release comparison to use declcfg.VersionRelease. |
| internal/operator-controller/bundleutil/bundle.go | Updates bundle property parsing and MetadataFor conversion to use declcfg.Release / declcfg.VersionRelease and new legacy parsing/conversion helpers. |
| internal/operator-controller/bundleutil/bundle_test.go | Updates bundleutil tests for declcfg.VersionRelease expectations. |
| internal/operator-controller/bundle/versionrelease.go | Deletes the duplicated internal release/version types and logic. |
| internal/operator-controller/bundle/versionrelease_test.go | Deletes unit tests for the removed internal release/version types. |
| helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml | Updates generated Helm base CRD for ClusterExtension (includes generator version annotation change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2771 +/- ##
==========================================
- Coverage 70.42% 70.31% -0.12%
==========================================
Files 143 142 -1
Lines 10625 10577 -48
==========================================
- Hits 7483 7437 -46
+ Misses 2580 2579 -1
+ Partials 562 561 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2865724 to
ccc8f3b
Compare
tmshort
left a comment
There was a problem hiding this comment.
Most of this is changing the namespace of an API, but there is some de-duplication that could be done.
ac0cad4 to
e0fe939
Compare
e0fe939 to
da8ab9c
Compare
da8ab9c to
21e1ef3
Compare
518364a to
21e1ef3
Compare
perdasilva
left a comment
There was a problem hiding this comment.
Code Review: Consolidate Release types with operator-registry
4 inline comments posted + 3 additional findings below.
Double JSON unmarshal in parseVersionRelease (bundleutil/bundle.go:66-76)
pkgData is unmarshalled twice: once into property.Package (line 66) and again into a helper struct (line 76) just to detect Release *string presence. Only pkg.Version is actually used from property.Package. A single struct struct{ Version string \json:"version"`; Release *string `json:"release"` }` would serve both purposes in one unmarshal pass.
SuccessorsOf double-parses installed bundle version (successors.go:57-75)
parseInstalledBundleVersionRelease (line 57) parses installedBundle.Version into a bsemver.Version, then legacySuccessor (line 75) parses the exact same string again via bsemver.Parse. The already-parsed version could be passed to legacySuccessor instead.
33 comparison test cases deleted without equivalent upstream coverage
The deleted bundle/versionrelease_test.go contained TestRelease_Compare (17 cases) and TestVersionRelease_Compare (16 cases). operator-registry v1.72.0's versionrelease_test.go has zero dedicated Compare tests — only a single equality assertion inside a round-trip test. ParseLegacyVersionRelease also has no direct unit tests (only indirect coverage through GetVersionAndRelease). Consider either adding comparison tests upstream or keeping a subset here.
| } | ||
|
|
||
| var release bundle.Release | ||
| var release declcfg.Release |
There was a problem hiding this comment.
This block (lines 33-51) is a semantic duplicate of parseExplicitRelease in bundleutil/bundle.go (lines 99-120): both parse version, branch on empty-vs-nonempty release, construct VersionRelease.
Consider exporting parseExplicitRelease as ParseExplicitRelease and calling it from here to avoid drift if either copy changes.
There was a problem hiding this comment.
done - exported parseExplicitRelease as ParseExplicitRelease and called it from parseInstalledBundleVersionRelease to eliminate the duplication. Fixed in latest commit
| Build: vr.Version.Build, | ||
| } | ||
| if len(vr.Release) > 0 { | ||
| v.Build = make([]string, len(vr.Release)) |
There was a problem hiding this comment.
nit: This manual loop duplicates the slicesutil.Map pattern already used in compare/compare.go:35 for the identical PRVersion→string conversion. The old deleted code also used slicesutil.Map here.
There was a problem hiding this comment.
fixed - replaced the manual loop with slicesutil.Map. addressed in latest commit.
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
- Export parseExplicitRelease as ParseExplicitRelease and use it from parseInstalledBundleVersionRelease to deduplicate logic - Replace manual loop with slicesutil.Map in asLegacyRegistryV1Version - Update test error message expectation Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
21e1ef3 to
74c294c
Compare
Description
Removes duplicate
bundle.Releaseandbundle.VersionReleasetype definitions in favor of usingdeclcfg.Releaseanddeclcfg.VersionReleasefrom operator-registry.This consolidates type definitions between operator-controller and operator-registry, eliminating code duplication and aligning with the vision from OPRUN-4548.
Changes:
internal/operator-controller/bundle/versionrelease.goand the test filedeclcfg.VersionReleaseanddeclcfg.Releasefrom operator-registryBundleMetadata.Release) remains*stringwith conversion at:bundleutil.MetadataFor(declcfg -> API)catalogmetadata/filter.parseInstalledBundleVersionRelease(API -> declcfg)Reviewer Checklist