Commit ea3f9d66 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Update WAF service to use gateway names in MatchExpression scope

- Modify the updateConfigMap method to replace the scope with gateway names instead of IDs
- Enhance the handling of WAF service configurations for improved clarity and functionality
parent d3c57913
...@@ -1012,14 +1012,15 @@ func (s *wafService) updateConfigMap(ctx context.Context, req *MatcherExpr, regi ...@@ -1012,14 +1012,15 @@ func (s *wafService) updateConfigMap(ctx context.Context, req *MatcherExpr, regi
if err != nil { if err != nil {
return fmt.Errorf("failed to get config map: %v", err) return fmt.Errorf("failed to get config map: %v", err)
} }
scope := []string{}
for _, id := range req.Scope { gatewayNames := []string{}
scope = append(scope, strconv.FormatUint(uint64(id), 10)) for _, wafSvc := range wafSvc {
gatewayNames = append(gatewayNames, wafSvc.GatewayName)
} }
matchExpr := v1alpha1.MatchExpression{ matchExpr := v1alpha1.MatchExpression{
ID: req.ID, ID: req.ID,
Name: req.Name, Name: req.Name,
Scope: strings.Join(scope, ","), Scope: strings.Join(gatewayNames, ","),
Mode: req.Mode, Mode: req.Mode,
Expr: req.Expr, Expr: req.Expr,
Status: req.Status, Status: req.Status,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment