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

Possibility of an upgrade from one package to another #466

Closed
m1kola opened this issue Oct 18, 2023 · 3 comments · Fixed by #532
Closed

Possibility of an upgrade from one package to another #466

m1kola opened this issue Oct 18, 2023 · 3 comments · Fixed by #532
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@m1kola
Copy link
Member

m1kola commented Oct 18, 2023

I think there is a case when there are packages package1 and package2 with bundles which share the same bundle image. I think two following pieces of code (they work together) might allow upgrading from package1 to package2.

if sourceImage != nil && sourceImage.Ref != "" {
if processed.Has(sourceImage.Ref) {
continue
}
processed.Insert(sourceImage.Ref)
ips, err := NewInstalledPackageVariableSource(o.catalogClient, bundleDeployment.Spec.Template.Spec.Source.Image.Ref)
if err != nil {
return nil, err
}
variableSources = append(variableSources, ips)
}

// find corresponding bundle for the installed content
resultSet := catalogfilter.Filter(allBundles, catalogfilter.WithBundleImage(r.bundleImage))
if len(resultSet) == 0 {
return nil, r.notFoundError()
}
// TODO: fast follow - we should check whether we are already supporting the channel attribute in the operator spec.
// if so, we should take the value from spec of the operator CR in the owner ref of the bundle deployment.
// If that channel is set, we need to update the filter above to filter by channel as well.
sort.SliceStable(resultSet, func(i, j int) bool {
return catalogsort.ByVersion(resultSet[i], resultSet[j])
})
installedBundle := resultSet[0]

E.g. when catalogs (single catalog or two different catalogs) have something like this:

package1 bundles:

  • image:tag1 - version 1.0.0

package2 bundles:

  • image:tag1 - version 1.0.0
  • image:tag2 - version 1.0.1

In this case, I think, when we install package1 at version 1.0.0 and then upgrade - our installed bundle might end up being the one from package2 since we search bundes by image references. And installed bundle is driving successors.

I looked into how to mitigate this in #442 but it didn't feel like the right solutiion.

@m1kola m1kola added the kind/bug Categorizes issue or PR as related to a bug. label Oct 18, 2023
@joelanford
Copy link
Member

In this case, I think, when we install package1 at version 1.0.0 and then upgrade - our installed bundle might end up being the one from package2 since we search bundes by image references. And installed bundle is driving successors.

This should not be possible if we are filtering bundles by package name based on Operator.spec.packageName.

@m1kola
Copy link
Member Author

m1kola commented Oct 30, 2023

This should not be possible if we are filtering bundles by package name based on Operator.spec.packageName.

We don't seem to do that: I can only see filtering by bundle image here. And we filter successors by package name, but we rely on installed package name.

I think as part of work for #449 I will have to have both Operator and BundleDeployment available in the relevant code (so we can switch between enforcing and ignoring upgrade edge constraints). And it will enable us filtering by package name specified on the Operator spec.

@joelanford
Copy link
Member

Yeah, I think I started to put the pieces together as I reviewed #460, and I left a few comments in this area:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants