From efd37a1c74e89f1a708cff784721a5a507318032 Mon Sep 17 00:00:00 2001 From: wangyelei Date: Tue, 24 Dec 2024 13:57:43 +0800 Subject: [PATCH] chore: replace prefix match with compDefMatched --- controllers/apps/componentversion_controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/apps/componentversion_controller.go b/controllers/apps/componentversion_controller.go index 581aca306db..0512740055b 100644 --- a/controllers/apps/componentversion_controller.go +++ b/controllers/apps/componentversion_controller.go @@ -447,12 +447,12 @@ func serviceVersionToCompDefinitions(ctx context.Context, cli client.Reader, // compatibleServiceVersions4Definition returns all service versions that are compatible with specified component definition. func compatibleServiceVersions4Definition(compDef *appsv1alpha1.ComponentDefinition, compVersion *appsv1alpha1.ComponentVersion) sets.Set[string] { - prefixMatch := func(prefix string) bool { - return strings.HasPrefix(compDef.Name, prefix) + compDefMatched := func(compDefPattern string) bool { + return component.CompDefMatched(compDef.Name, compDefPattern) } releases := make(map[string]bool, 0) for _, rule := range compVersion.Spec.CompatibilityRules { - if slices.IndexFunc(rule.CompDefs, prefixMatch) >= 0 { + if slices.IndexFunc(rule.CompDefs, compDefMatched) >= 0 { for _, release := range rule.Releases { releases[release] = true }