diff --git a/controllers/apps/componentversion_controller.go b/controllers/apps/componentversion_controller.go index 89e6c69c048..978db976609 100644 --- a/controllers/apps/componentversion_controller.go +++ b/controllers/apps/componentversion_controller.go @@ -471,12 +471,12 @@ func serviceVersionToCompDefinitions(ctx context.Context, cli client.Reader, // compatibleServiceVersions4Definition returns all service versions that are compatible with specified component definition. func compatibleServiceVersions4Definition(compDef *appsv1.ComponentDefinition, compVersion *appsv1.ComponentVersion) sets.Set[string] { - prefixMatch := func(prefix string) bool { - return strings.HasPrefix(compDef.Name, prefix) + match := func(pattern string) bool { + return component.PrefixOrRegexMatched(compDef.Name, pattern) } releases := make(map[string]bool, 0) for _, rule := range compVersion.Spec.CompatibilityRules { - if slices.IndexFunc(rule.CompDefs, prefixMatch) >= 0 { + if slices.IndexFunc(rule.CompDefs, match) >= 0 { for _, release := range rule.Releases { releases[release] = true } diff --git a/pkg/controller/component/component_version.go b/pkg/controller/component/component_version.go index 9fe96335325..58d05c787d9 100644 --- a/pkg/controller/component/component_version.go +++ b/pkg/controller/component/component_version.go @@ -275,7 +275,7 @@ func checkNMergeImages(serviceVersion string, appsInDef, appsInVer map[string]ap if len(ver.name) == 0 { match, err := CompareServiceVersion(serviceVersion, def.version) if err != nil { - def.err = err + def.err = fmt.Errorf("failed to compare service version (service version: %s, def version: %s): %w", serviceVersion, def.version, err) } if !match && def.required { def.err = fmt.Errorf("no matched image found for container %s with required version %s", name, serviceVersion)