adjust the priority for wasmplugin to take effect on matching services (#1270)

This commit is contained in:
澄潭
2024-09-03 09:43:58 +08:00
committed by GitHub
parent 144d514eb0
commit 7b2b522160

View File

@@ -894,16 +894,16 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
}) })
continue continue
} }
// match domain // match service
for _, domain := range rule.Domain { for _, service := range rule.Service {
matchItems = append(matchItems, &_struct.Value{ matchItems = append(matchItems, &_struct.Value{
Kind: &_struct.Value_StringValue{ Kind: &_struct.Value_StringValue{
StringValue: domain, StringValue: service,
}, },
}) })
} }
if len(matchItems) > 0 { if len(matchItems) > 0 {
v.StructValue.Fields["_match_domain_"] = &_struct.Value{ v.StructValue.Fields["_match_service_"] = &_struct.Value{
Kind: &_struct.Value_ListValue{ Kind: &_struct.Value_ListValue{
ListValue: &_struct.ListValue{ ListValue: &_struct.ListValue{
Values: matchItems, Values: matchItems,
@@ -915,18 +915,18 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
}) })
continue continue
} }
// match service // match domain
for _, service := range rule.Service { for _, domain := range rule.Domain {
matchItems = append(matchItems, &_struct.Value{ matchItems = append(matchItems, &_struct.Value{
Kind: &_struct.Value_StringValue{ Kind: &_struct.Value_StringValue{
StringValue: service, StringValue: domain,
}, },
}) })
} }
if len(matchItems) == 0 { if len(matchItems) == 0 {
return nil, fmt.Errorf("invalid match rule has no match condition, rule:%v", rule) return nil, fmt.Errorf("invalid match rule has no match condition, rule:%v", rule)
} }
v.StructValue.Fields["_match_service_"] = &_struct.Value{ v.StructValue.Fields["_match_domain_"] = &_struct.Value{
Kind: &_struct.Value_ListValue{ Kind: &_struct.Value_ListValue{
ListValue: &_struct.ListValue{ ListValue: &_struct.ListValue{
Values: matchItems, Values: matchItems,