-
Notifications
You must be signed in to change notification settings - Fork 54
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
Remove Entities and EntitySources #413
Remove Entities and EntitySources #413
Conversation
// A bundle can be present in multiple channels and we need a separate variable | ||
// with a unique ID for each occurrence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is the data model we already have, but I'm really not a fan. There should be a single unique ID for each bundle in a particular catalog. I'm worried that creating multiple entities per bundle (one for each channel), will result in very confusing resolution unsat error messages.
Also, generating all of these extra bundle variables and making the variable space larger presumably requires more memory and CPU for resolution.
Not saying we fix this now, but definitely something we should fix soon before it becomes impossible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelanford I wrote this code and I'm not a fan too! :) It is here because this is how it currently works in main
: see internal/resolution/entitysources/catalogdsource.go
where we create multiple instances of Entity
- one per bundle occurnace in package channels.
However since I wrote this I was wondering whether it is actually necessary to have channel aware variables with all the filtering we do before we give it to the solver. I suggest that we leave it like this for now to stay close to what we already have in main
, but look into it as a separate effort. I created #414 for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether it is actually necessary to have channel aware variables with all the filtering we do before we give it to the solver.
There are at least two ways to do this:
- As you said, when building bundle variables from an
Operator
, we know whether or not we need to filter by channels, and we know what all of the channel membership is. When we build the operator variable, we would end up with something close toOperatorFoo
depends onBundleVariables(<set-of-bundle-variables-that-match-spec-specified-constraints>)
. So we would be able to filter on package name, bundle version, channel, and upgrade candidates before we even hand a variable off to the resolver. This is pretty much what I did in my PoC starting around here: https://github.com/joelanford/operator-controller/blob/31082f42fa9fbe61a4c9155683d0956e2425b774/internal/resolution/v2/variablesources/operator.go#L71 - Another option is to build variables for channels, like:
CatFoo/PackageBar/ChannelAlpha
depends onBundleVariables(<set of bundles in the channel>)
. And then if anOperator
specifies the alpha channel, then you'd makeOperatorFoo
depends onCatFoo/PackageBar/ChannelAlpha
. (and if it doesn't specify a channel, then intuitively, it would have no dependencies on any channel variables).
One thing to worry about with option (2) is if we ever have an API that let's you specify that the bundle can come from multiple channels. With option 2, what's the preference ordering? Is it first by channel, then by version? Or is it first by version, then by channel? Either way, that preference order is easier to model/implement with option (1) because you can sort a flat list of bundles however you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a bunch of "entity" leftovers in names. Probably there are more.
internal/resolution/variablesources/bundles_and_dependencies.go
Outdated
Show resolved
Hide resolved
8414cde
to
5f1d0df
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #413 +/- ##
==========================================
+ Coverage 83.97% 84.42% +0.45%
==========================================
Files 27 23 -4
Lines 1073 777 -296
==========================================
- Hits 901 656 -245
+ Misses 119 86 -33
+ Partials 53 35 -18
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@@ -575,43 +580,6 @@ var _ = Describe("Operator Controller Test", func() { | |||
}) | |||
}) | |||
}) | |||
When("the selected bundle's image ref cannot be parsed", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this test as the bundle path retrieval no longer has an error path with the new struct.
@dtfranz please update the description to say either "resolves" or "fixes" instead of "addresses". The former will result in the associated issue being closed when the PR is merged. That doesn't happen with "addresses". Thanks. |
5f1d0df
to
d3dd487
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am out of time for today, but wanted to submit what I had for now. Can try to review more tomorrow.
It looks like this may actually resolve the issue from #419 as well. In this PR (or maybe a follow-up is okay), can we update the controller unit test and the e2e test to add a new See:
|
d3dd487
to
60c02a1
Compare
Converted back to draft to avoud accidental merge. |
60c02a1
to
59c7dc1
Compare
c16b861
to
57ebe86
Compare
Is this that TODO comment I asked if there was a issue for. Definitely seems related. Seems like the |
The changes are pretty big here already, I'd like to take care of this in a follow-up if that's alright. I think that you are correct though, that this should resolve that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few copy/pastas, but LGTM
Signed-off-by: Mikalai Radchuk <[email protected]> Signed-off-by: Daniel Franz<[email protected]>
Signed-off-by: Mikalai Radchuk <[email protected]>
* Removes provides+required GVK and associated tests. GVK related code was a dead weight since were never set GVK properties on bundle entity. * Remove entity + entitysource and associated util pkgs Signed-off-by: dtfranz <[email protected]>
Signed-off-by: dtfranz <[email protected]>
Signed-off-by: dtfranz <[email protected]>
57ebe86
to
832502d
Compare
I believe all the remaining feedback was addressed. Will convert back to ready for review shortly.
@joelanford not exactly, but it is related. In With new implementation we have all the properties from catalog's metadata "as is" in The issue from TODO does not affect this PR or even master as we currently do not use any props with multiple instances. However it is nice to address. I created #427 for this. |
internal/resolution/variablesources/bundles_and_dependencies_test.go
Outdated
Show resolved
Hide resolved
832502d
to
9d88cb0
Compare
internal/resolution/variablesources/bundles_and_dependencies_test.go
Outdated
Show resolved
Hide resolved
ad3dd46
to
97e80f6
Compare
Signed-off-by: dtfranz <[email protected]>
97e80f6
to
d35618b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
P.S. Not submitting this as "Approve" review beucase I was heavily involved in this and it is not right to approve my own code .
Description
Bumps deppy version and removes use of Entity and EntitySource objects. In their place, the CatalogMetadata client is used along with new structs which are wrappers for the declcfg objects.
Resolves #347