baerwang commented on code in PR #446:
URL: https://github.com/apache/dubbo-go-pixiu/pull/446#discussion_r952316733


##########
pkg/config/xds/xds.go:
##########
@@ -54,20 +56,58 @@ type (
 
 func (a *Xds) createApiManager(config *model.ApiConfigSource,
        node *model.Node,
-       resourceTypes ...apiclient.ResourceTypeName) DiscoverApi {
+       resourceType apiclient.ResourceTypeName) DiscoverApi {
        if config == nil {
                return nil
        }
 
        switch config.APIType {
        case model.ApiTypeGRPC:
-               return apiclient.CreateGrpcApiClient(config, node, a.exitCh, 
resourceTypes...)
+               return apiclient.CreateGrpExtensionApiClient(config, node, 
a.exitCh, resourceType)
+       case model.ApiTypeIstioGRPC:
+               dubboServices, api, done := a.readDubboServiceFromListener()
+               if done {
+                       return api
+               }
+               return apiclient.CreateEnvoyGrpcApiClient(config, node, 
a.exitCh, resourceType, apiclient.WithIstioService(dubboServices...))
        default:
                logger.Errorf("un-support the api type %s", config.APITypeStr)
                return nil
        }
 }
 
+func (a *Xds) readDubboServiceFromListener() ([]string, DiscoverApi, bool) {
+       dubboServices := make([]string, 0)

Review Comment:
   ```go
   listeners, err := a.listenerMg.CloneXdsControlListener()
   if err != nil {
        logger.Errorf("can not read listener. %v", err)
        return nil, nil, true
   }
   
   dubboServices := make([]string, 0)
   ```



##########
pkg/config/xds/xds.go:
##########
@@ -18,6 +18,8 @@
 package xds
 
 import (
+       "github.com/apache/dubbo-go-pixiu/pkg/common/constant"
+       "github.com/mitchellh/mapstructure"

Review Comment:
   import style



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to