Skip to content

Commit

Permalink
wasmplugin rule match support multi conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlanni committed Nov 25, 2024
1 parent bd22ad1 commit ed0e75a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pkg/ingress/config/ingress_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,6 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
ruleValues = append(ruleValues, &_struct.Value{
Kind: v,
})
continue
}
// match service
for _, service := range rule.Service {
Expand All @@ -947,7 +946,6 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
ruleValues = append(ruleValues, &_struct.Value{
Kind: v,
})
continue
}
// match domain
for _, domain := range rule.Domain {
Expand All @@ -957,19 +955,21 @@ func (m *IngressConfig) convertIstioWasmPlugin(obj *higressext.WasmPlugin) (*ext
},
})
}
if len(matchItems) == 0 {
return nil, fmt.Errorf("invalid match rule has no match condition, rule:%v", rule)
}
v.StructValue.Fields["_match_domain_"] = &_struct.Value{
Kind: &_struct.Value_ListValue{
ListValue: &_struct.ListValue{
Values: matchItems,
if len(matchItems) > 0 {
v.StructValue.Fields["_match_domain_"] = &_struct.Value{
Kind: &_struct.Value_ListValue{
ListValue: &_struct.ListValue{
Values: matchItems,
},
},
},
}
ruleValues = append(ruleValues, &_struct.Value{
Kind: v,
})
}
if len(ruleValues) == 0 {
return nil, fmt.Errorf("invalid match rule has no match condition, rule:%v", rule)
}
ruleValues = append(ruleValues, &_struct.Value{
Kind: v,
})
}
if len(ruleValues) > 0 {
hasValidRule = true
Expand Down

0 comments on commit ed0e75a

Please sign in to comment.