Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

joelanford
Copy link
Member

@joelanford joelanford commented Jul 11, 2024

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-ci openshift-ci bot 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
Copy link

netlify bot commented Jul 11, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit b59ac9e
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/6696b6016c7d880008b40fb2
😎 Deploy Preview https://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.

Copy link

codecov bot commented Jul 11, 2024

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.

Files Patch % Lines
internal/catalogmetadata/filter/successors.go 74.46% 6 Missing and 6 partials ⚠️
cmd/manager/main.go 52.17% 7 Missing and 4 partials ⚠️
...nternal/controllers/clusterextension_controller.go 90.27% 5 Missing and 2 partials ⚠️
internal/resolve/catalog.go 95.45% 2 Missing and 2 partials ⚠️
internal/bundleutil/bundle.go 86.66% 1 Missing and 1 partial ⚠️
internal/resolve/resolver.go 0.00% 2 Missing ⚠️
internal/catalogmetadata/client/client.go 94.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     
Flag Coverage Δ
e2e 55.67% <54.24%> (+1.29%) ⬆️
unit 43.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 joelanford force-pushed the use-declcfg-types branch 4 times, most recently from 3664e64 to a03a969 Compare July 12, 2024 18:31
@openshift-merge-robot openshift-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-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2024
@joelanford joelanford changed the title 🌱 WIP: use operator-registry's FBC types directly 🌱 use operator-registry's FBC types directly; add Resolver interface Jul 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 owner July 12, 2024 21:04
@openshift-ci openshift-ci bot 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
Contributor

tmshort commented Jul 15, 2024

Upgrade e2e fails...

@joelanford
Copy link
Member Author

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

@joelanford
Copy link
Member Author

joelanford commented Jul 15, 2024

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

EDIT: It did! 🎉

perdasilva
perdasilva previously approved these changes Jul 16, 2024
Copy link
Contributor

@perdasilva perdasilva left a comment

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 =))

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
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
Member Author

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.


// 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
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
Member Author

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.

internal/bundleutil/bundle.go Show resolved Hide resolved
@perdasilva
Copy link
Contributor

also it may impact #1030 @bentito

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

Most recent push:

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

Copy link
Contributor

@dtfranz dtfranz left a comment

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-ci openshift-ci bot 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 6cd022e Jul 17, 2024
17 of 18 checks passed
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants