Commit bf474a69 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Fix listener host parsing in EnableListenerWafs method

- Add error logging for listener list retrieval
- Modify host extraction to use substring before port separator
- Improve error handling and logging in WAF service method
parent 4bb0b53d
......@@ -607,6 +607,7 @@ func (s *wafService) EnableListenerWafs(ctx context.Context, req *EnableListener
listenerList, err := client.WafV1alpha1().Services(req.Namespace).List(ctx, metav1.ListOptions{LabelSelector: fmt.Sprintf("apigateway_name=%s", req.GatewayName)})
if err != nil {
log.Error().Msgf("failed to get listener list: %v", err)
return err
}
......@@ -641,7 +642,7 @@ func (s *wafService) EnableListenerWafs(ctx context.Context, req *EnableListener
desiredPortSet.Insert(portInt)
log.Info().Msgf("listener: %v", listener.Name)
hosts := strings.Split(listener.HostsAndPort, "@")
hosts := strings.Split(listener.HostsAndPort[:index], "@")
wafMap[portInt] = hosts
}
......
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