You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2020/03/18 06:12:04 UTC

[servicecomb-mesher] branch master updated: update version of go-chassis to support use kie as config server (#107)

This is an automated email from the ASF dual-hosted git repository.

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-mesher.git


The following commit(s) were added to refs/heads/master by this push:
     new 8075bf5  update version of go-chassis to support use kie as config server (#107)
8075bf5 is described below

commit 8075bf50a07d2ecd13b8d48dad10792ca87eb96c
Author: zhulijian <zh...@huawei.com>
AuthorDate: Wed Mar 18 14:11:55 2020 +0800

    update version of go-chassis to support use kie as config server (#107)
---
 cmd/mesher/mesher.go                       | 4 ++--
 go.mod                                     | 6 +++---
 proxy/bootstrap/bootstrap.go               | 3 +--
 proxy/plugins/registry/istiov2/cache.go    | 4 ++--
 proxy/plugins/registry/istiov2/registry.go | 4 ++--
 proxy/register/register.go                 | 8 +++++---
 6 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/cmd/mesher/mesher.go b/cmd/mesher/mesher.go
index 2f7dd9a..2e062e8 100644
--- a/cmd/mesher/mesher.go
+++ b/cmd/mesher/mesher.go
@@ -23,8 +23,6 @@ import (
 	_ "github.com/apache/servicecomb-mesher/proxy/resolver/authority"
 
 	_ "github.com/apache/servicecomb-mesher/proxy/handler"
-	// config server
-	_ "github.com/apache/servicecomb-kie/client/adaptor"
 	//protocols
 	_ "github.com/apache/servicecomb-mesher/proxy/protocol/grpc"
 	_ "github.com/apache/servicecomb-mesher/proxy/protocol/http"
@@ -38,6 +36,8 @@ import (
 	_ "github.com/apache/servicecomb-mesher/proxy/control/istio"
 
 	_ "github.com/apache/servicecomb-mesher/proxy/handler/oauth2"
+
+	_ "github.com/go-chassis/go-chassis/middleware/circuit"
 )
 
 func main() {
diff --git a/go.mod b/go.mod
index f3d4d7a..a5a1f5b 100644
--- a/go.mod
+++ b/go.mod
@@ -1,12 +1,11 @@
 module github.com/apache/servicecomb-mesher
 
 require (
-	github.com/apache/servicecomb-kie v0.1.1-0.20191119112752-d564a5ac0115
 	github.com/envoyproxy/go-control-plane v0.6.0
 	github.com/ghodss/yaml v1.0.0
 	github.com/go-chassis/foundation v0.1.1-0.20191113114104-2b05871e9ec4
-	github.com/go-chassis/go-archaius v1.0.1-0.20200121100918-32f6f1a3f33d
-	github.com/go-chassis/go-chassis v1.8.3-0.20200227124115-fab00e1f56fe
+	github.com/go-chassis/go-archaius v1.2.1-0.20200309104817-8c3d4e87d33c
+	github.com/go-chassis/go-chassis v1.8.2-0.20200317131017-6cbcbc9ae9e6
 	github.com/go-chassis/gohessian v0.0.0-20180702061429-e5130c25af55
 	github.com/go-mesh/openlogging v1.0.1
 	github.com/gogo/googleapis v1.3.1 // indirect
@@ -20,6 +19,7 @@ require (
 	github.com/urfave/cli v1.20.1-0.20181029213200-b67dcf995b6a
 	golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
 	golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
+	golang.org/x/sys v0.0.0-20191018095205-727590c5006e // indirect
 	google.golang.org/grpc v1.19.1
 	gopkg.in/yaml.v2 v2.2.4
 	k8s.io/apimachinery v0.17.0
diff --git a/proxy/bootstrap/bootstrap.go b/proxy/bootstrap/bootstrap.go
index 2676a25..8a397ff 100644
--- a/proxy/bootstrap/bootstrap.go
+++ b/proxy/bootstrap/bootstrap.go
@@ -114,7 +114,7 @@ func SetHandlers() {
 	consumerChain := strings.Join([]string{
 		chassisHandler.Router,
 		chassisHandler.RateLimiterConsumer,
-		chassisHandler.BizkeeperConsumer,
+		"bizkeeper-consumer",
 		chassisHandler.Loadbalance,
 		chassisHandler.Transport,
 	}, ",")
@@ -137,7 +137,6 @@ func SetHandlers() {
 func InitEgressChain() error {
 	egresschain := strings.Join([]string{
 		handler.RateLimiterConsumer,
-		handler.BizkeeperConsumer,
 		handler.Transport,
 	}, ",")
 
diff --git a/proxy/plugins/registry/istiov2/cache.go b/proxy/plugins/registry/istiov2/cache.go
index 15c009d..f8e609e 100644
--- a/proxy/plugins/registry/istiov2/cache.go
+++ b/proxy/plugins/registry/istiov2/cache.go
@@ -111,8 +111,8 @@ func (cm *CacheManager) pullMicroserviceInstance() error {
 				msi := &registry.MicroServiceInstance{}
 				msi.InstanceID = strings.Replace(addr, ":", "_", 0)
 				msi.HostName = clusterInfo.ClusterName
-				msi.EndpointsMap = map[string]string{
-					common.ProtocolRest: addr,
+				msi.EndpointsMap = map[string]*registry.Endpoint{
+					common.ProtocolRest: {Address: addr},
 				}
 				msi.DefaultEndpoint = addr
 				msi.DefaultProtocol = common.ProtocolRest
diff --git a/proxy/plugins/registry/istiov2/registry.go b/proxy/plugins/registry/istiov2/registry.go
index 304b015..da46c7f 100644
--- a/proxy/plugins/registry/istiov2/registry.go
+++ b/proxy/plugins/registry/istiov2/registry.go
@@ -100,8 +100,8 @@ func toMicroServiceInstance(clusterName string, lbendpoint *apiv2endpoint.LbEndp
 	msi.InstanceID = addr + "_" + portStr
 	msi.HostName = clusterName
 	msi.DefaultEndpoint = addr + ":" + portStr
-	msi.EndpointsMap = map[string]string{
-		common.ProtocolRest: msi.DefaultEndpoint,
+	msi.EndpointsMap = map[string]*registry.Endpoint{
+		common.ProtocolRest: {Address: msi.DefaultEndpoint},
 	}
 	msi.DefaultProtocol = common.ProtocolRest
 	msi.Metadata = tags
diff --git a/proxy/register/register.go b/proxy/register/register.go
index b4ea879..d37dd6f 100644
--- a/proxy/register/register.go
+++ b/proxy/register/register.go
@@ -49,16 +49,18 @@ func AdaptEndpoints() error {
 		newProtoMap[n] = proto
 	}
 	newProtoMap[chassisCommon.ProtocolRest] = oldProtoMap[common.HTTPProtocol]
-	registry.InstanceEndpoints, err = registry.MakeEndpointMap(newProtoMap)
+	eps, err := registry.MakeEndpointMap(newProtoMap)
 	if err != nil {
 		return err
 	}
-	for protocol, address := range registry.InstanceEndpoints {
-		if address == "" {
+	for protocol, ep := range eps {
+		if ep.Address == "" {
 			port := strings.Split(newProtoMap[protocol].Listen, ":")
 			if len(port) == 2 { //check if port is not specified along with ip address, eventually in case port is not specified, server start will fail in subsequent processing.
 				registry.InstanceEndpoints[protocol] = iputil.GetLocalIP() + ":" + port[1]
 			}
+		} else {
+			registry.InstanceEndpoints[protocol] = ep.Address
 		}
 	}