diff --git a/cluster/directory/base_directory.go b/cluster/directory/base_directory.go index c213677582be7b67086464a9f811cf1f3c07cb50..3a6a337db095572069e7174ff57df26240d42e1b 100644 --- a/cluster/directory/base_directory.go +++ b/cluster/directory/base_directory.go @@ -72,42 +72,6 @@ func (dir *BaseDirectory) GetDirectoryUrl() *common.URL { return dir.url } -// SetRouters Convert url to routers and add them into dir.routerChain -func (dir *BaseDirectory) SetRouters(urls []*common.URL) { - //if len(urls) == 0 { - // return - //} - // - //routers := make([]router.PriorityRouter, 0, len(urls)) - // - //rc := dir.routerChain - // - //for _, url := range urls { - // routerKey := url.GetParam(constant.ROUTER_KEY, "") - // - // if len(routerKey) == 0 { - // continue - // } - // if url.Protocol == constant.CONDITION_ROUTE_PROTOCOL { - // if !dir.isProperRouter(url) { - // continue - // } - // } - // factory := extension.GetRouterFactory(url.Protocol) - // r, err := factory.NewPriorityRouter(url, rc.GetNotifyChan()) - // if err != nil { - // logger.Errorf("Create router fail. router key: %s, url:%s, error: %+v", routerKey, url.Service(), err) - // return - // } - // routers = append(routers, r) - //} - // - //logger.Infof("Init file condition router success, size: %v", len(routers)) - //dir.mutex.Lock() - //rc.AddRouters(routers) - //dir.mutex.Unlock() -} - func (dir *BaseDirectory) isProperRouter(url *common.URL) bool { app := url.GetParam(constant.APPLICATION_KEY, "") dirApp := dir.GetUrl().GetParam(constant.APPLICATION_KEY, "") diff --git a/cluster/router/uniform/router_chain.go b/cluster/router/uniform/router_chain.go index 436fb0e36c101a010edbccbce2079c309e993290..09d3e10d0ec2eb24cc036267ba703e7857224fd1 100644 --- a/cluster/router/uniform/router_chain.go +++ b/cluster/router/uniform/router_chain.go @@ -153,7 +153,7 @@ func (r *RouterChain) Process(event *config_center.ConfigChangeEvent) { } if event.ConfigType == remoting.EventTypeDel { - + // todo delete router } } diff --git a/cluster/router/uniform/uniform_rule.go b/cluster/router/uniform/uniform_rule.go index 5d2e15f786cac9a2d489bf97ad6d611e6da8bcbf..e11d29c1c3d7f3d6418ea45bdc859b3cae605eff 100644 --- a/cluster/router/uniform/uniform_rule.go +++ b/cluster/router/uniform/uniform_rule.go @@ -183,6 +183,7 @@ func newUniformRule(dubboRoute *config.DubboRoute, destinationMap map[string]map func (u *UniformRule) route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker { // service rule + destination -> filter resultInvokers := make([]protocol.Invoker, 0) + var err error matchService := false for _, v := range u.services { // check if match service field @@ -200,7 +201,7 @@ func (u *UniformRule) route(invokers []protocol.Invoker, url *common.URL, invoca for _, rule := range u.virtualServiceRules { if rule.match(url, invocation) { // match this rule, do get target logic - resultInvokers, err := rule.getRuleTargetInvokers(invokers) + resultInvokers, err = rule.getRuleTargetInvokers(invokers) if err != nil { logger.Error("getRuleTargetInvokers from rule err = ", err) return nil diff --git a/registry/directory/directory.go b/registry/directory/directory.go index aace9cc941e2e4c6554a24c3d0ff6445bae62160..8ef6f9150d49020993e911529a603e718fd8eaf4 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -256,11 +256,11 @@ func (dir *RegistryDirectory) cacheInvokerByEvent(event *registry.ServiceEvent) // configRouters configures dynamic routers into the router chain, but, the current impl is incorrect, see FIXME above. func (dir *RegistryDirectory) configRouters() { - var urls []*common.URL - for _, v := range config.GetRouterURLSet().Values() { - urls = append(urls, v.(*common.URL)) - } - + //var urls []*common.URL + //for _, v := range config.GetRouterURLSet().Values() { + // urls = append(urls, v.(*common.URL)) + //} + // //if len(urls) > 0 { // dir.SetRouters(urls) //} diff --git a/remoting/k8sCRD/client.go b/remoting/k8sCRD/client.go index 4b3c1a1e00678dcb8dd22956b4ed5e54a1accf8c..87fdd8cd85f2d5eb4c47521eb7260c1e28b25804 100644 --- a/remoting/k8sCRD/client.go +++ b/remoting/k8sCRD/client.go @@ -63,7 +63,7 @@ func NewK8sCRDClient(groupName, groupVersion, namespace string, handlers ...List SchemeBuilder := runtime.NewSchemeBuilder(newClient.addKnownTypes) // add to scheme - if err := SchemeBuilder.AddToScheme(scheme.Scheme); err != nil { + if err = SchemeBuilder.AddToScheme(scheme.Scheme); err != nil { logger.Error("AddToScheme failed in k8s CRD process") return nil, err }