Skip to content

Commit 9a58660

Browse files
gallettilancedinhxuanvu
authored andcommitted
feat(resolver): filtering deprecated bundles in resolver
1 parent a8b00ef commit 9a58660

File tree

5 files changed

+232
-121
lines changed

5 files changed

+232
-121
lines changed

pkg/controller/registry/resolver/cache.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,17 @@ func WithPackage(pkg string) OperatorPredicate {
416416
}
417417
}
418418

419+
func WithoutDeprecatedProperty() OperatorPredicate {
420+
return func(o *Operator) bool {
421+
for _, p := range o.bundle.GetProperties() {
422+
if p.GetType() == string(opregistry.DeprecatedType) {
423+
return false
424+
}
425+
}
426+
return true
427+
}
428+
}
429+
419430
func WithVersionInRange(r semver.Range) OperatorPredicate {
420431
return func(o *Operator) bool {
421432
return o.version != nil && r(*o.version)

pkg/controller/registry/resolver/resolver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ func (r *SatResolver) SolveOperators(namespaces []string, csvs []*v1alpha1.Clust
7373
predicates = append(predicates, WithChannel(sub.Spec.Channel))
7474
}
7575

76+
predicates = append(predicates, WithoutDeprecatedProperty())
77+
7678
// find the currently installed operator (if it exists)
7779
var current *Operator
7880
for _, csv := range csvs {
@@ -297,6 +299,7 @@ func (r *SatResolver) getBundleInstallables(catalog registry.CatalogKey, predica
297299
errs = append(errs, err)
298300
continue
299301
}
302+
dependencyPredicates = append(dependencyPredicates, WithoutDeprecatedProperty())
300303
for _, d := range dependencyPredicates {
301304
// errors ignored; this will build an empty/unsatisfiable dependency if no candidates are found
302305
candidateBundles, _ := AtLeast(1, namespacedCache.FindPreferred(&bundle.sourceInfo.Catalog, d))

0 commit comments

Comments
 (0)