Skip to content

🌱 use operator-registry's FBC types directly; add Resolver interface - #1033

Merged
joelanford merged 1 commit into
operator-framework:mainfrom
joelanford:use-declcfg-types
Jul 17, 2024
Merged

🌱 use operator-registry's FBC types directly; add Resolver interface#1033
joelanford merged 1 commit into
operator-framework:mainfrom
joelanford:use-declcfg-types

Conversation

@joelanford

@joelanfordjoelanford commented Jul 11, 2024

Copy link
Copy Markdown
Member

Signed-off-by: Joe Lanford joe.lanford@gmail.com

Description

This is a code refactoring to:

  1. align operator-controller's resolver to use the FBC types directly, which seems like it would be able to evolve better alongside FBC evolution.
  2. introduce a resolver abstraction to the reconciler, which simplifies reconciler AND resolver testability

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ciopenshift-ciBot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 11, 2024
@netlify

netlifyBot commented Jul 11, 2024

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commitb59ac9e
🔍 Latest deploy loghttps://app.netlify.com/sites/olmv1/deploys/6696b6016c7d880008b40fb2
😎 Deploy Previewhttps://deploy-preview-1033--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov

codecovBot commented Jul 11, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 87.25490% with 39 lines in your changes missing coverage. Please review.

Project coverage is 72.10%. Comparing base (957fc1b) to head (b59ac9e).
Report is 1 commits behind head on main.

FilesPatch %Lines
internal/catalogmetadata/filter/successors.go74.46%6 Missing and 6 partials ⚠️
cmd/manager/main.go52.17%7 Missing and 4 partials ⚠️
...nternal/controllers/clusterextension_controller.go90.27%5 Missing and 2 partials ⚠️
internal/resolve/catalog.go95.45%2 Missing and 2 partials ⚠️
internal/bundleutil/bundle.go86.66%1 Missing and 1 partial ⚠️
internal/resolve/resolver.go0.00%2 Missing ⚠️
internal/catalogmetadata/client/client.go94.44%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1033 +/- ##
==========================================
- Coverage 73.60% 72.10% -1.50% 
==========================================
Files 30 31 +1 Lines 1951 1807 -144 ==========================================
- Hits 1436 1303 -133 + Misses 381 377 -4 + Partials 134 127 -7 
FlagCoverage Δ
e2e55.67% <54.24%> (+1.29%)⬆️
unit43.38% <78.43%> (-4.44%)⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joelanford
joelanfordforce-pushed the use-declcfg-types branch 4 times, most recently from 3664e64 to a03a969CompareJuly 12, 2024 18:31
@openshift-merge-robotopenshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2024
@openshift-merge-robotopenshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2024
@joelanfordjoelanford changed the title 🌱 WIP: use operator-registry's FBC types directly🌱 use operator-registry's FBC types directly; add Resolver interfaceJul 12, 2024
@joelanford
joelanford marked this pull request as ready for review July 12, 2024 21:04
@joelanford
joelanford requested a review from a team as a code ownerJuly 12, 2024 21:04
@openshift-ciopenshift-ciBot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 12, 2024
@tmshort

Copy link
Copy Markdown
Contributor

Upgrade e2e fails...

@joelanford

Copy link
Copy Markdown
MemberAuthor

I'm hoping #1050 improves the situation on the upgrade-e2e. I'll rebase after that merges.

@joelanford

joelanford commented Jul 15, 2024

Copy link
Copy Markdown
MemberAuthor

Rebased. Let's see if upgrade-e2e passes now.

EDIT: It did! 🎉

perdasilva
perdasilva previously approved these changes Jul 16, 2024

@perdasilvaperdasilva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm to me - just a couple of small questions but nothing that should block this (though some tracking tickets if we want to address anything would be good =))

Comment threadinternal/bundleutil/bundle.go Outdated
return nil, fmt.Errorf("no package property found in bundle %q", b.Name)
}

// MetadataFor returns a BundleMetadata for the given bundle. If the provided bundle is nil,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still accurate? Would something like the following be more accurate?

Suggested change
// MetadataFor returns a BundleMetadata for the given bundle. If the provided bundle is nil,
// MetadataFor returns a BundleMetadata for the given bundle name and version. If the provided bundle version is nil,

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this in two ways:

  1. Added name and version
  2. Dropped the second sentence because I changed the signature to avoid nil-pointer panic possibilities.

Comment threadinternal/bundleutil/bundle.go Outdated

// MetadataFor returns a BundleMetadata for the given bundle. If the provided bundle is nil,
// this function panics. It is up to the caller to ensure that the bundle is non-nil.
func MetadataFor(bundleName string, bundleVersion *bsemver.Version) *ocv1alpha1.BundleMetadata {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to wrap the bundle in an internal struct with this added method? I can see both ways working, I just don't know how "first class" this method needs to be.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catalogmetadata.Bundle was the wrapper that this PR removed, somewhat purposefully. What I had noticed is that we started losing parity with the FBC data model (we put channel membership and deprecation information in that wrapper). And that seemed like a recipe for more spaghetti-making when FBC evolves new types and semantics.

So I opted for functions over declcfg.Bundle rather than a wrapper type with methods.

Comment threadinternal/bundleutil/bundle.go
@perdasilva

Copy link
Copy Markdown
Contributor

also it may impact #1030@bentito

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@joelanford

Copy link
Copy Markdown
MemberAuthor

Most recent push:

  1. Rebases to main
  2. Changes bundleutil.MetadataFor to fix GoDoc and avoid accepting a pointer to a blang semver version.

@joelanford
joelanford enabled auto-merge July 16, 2024 18:34

@dtfranzdtfranz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
Looks like this will make the codebase a lot more manageable!

@joelanford
joelanford added this pull request to the merge queue Jul 17, 2024
@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2024
Merged via the queue into operator-framework:main with commit 6cd022eJul 17, 2024
@joelanford
joelanford deleted the use-declcfg-types branch July 20, 2024 01:59
perdasilva pushed a commit to LalatenduMohanty/operator-controller that referenced this pull request Aug 13, 2024
perdasilva pushed a commit to kevinrizza/operator-controller that referenced this pull request Aug 13, 2024
@skattojuskattoju mentioned this pull request Sep 25, 2024
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@joelanford@tmshort@perdasilva@dtfranz@openshift-merge-robot