-
Notifications
You must be signed in to change notification settings - Fork 66
Description
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
.
operator-controller/internal/resolution/variablesources/bundle_deployment.go
Lines 43 to 53 in 7161a7b
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) | |
} |
operator-controller/internal/resolution/variablesources/installed_package.go
Lines 31 to 43 in 7161a7b
// 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
- version1.0.0
package2
bundles:
image:tag1
- version1.0.0
image:tag2
- version1.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.