xds: set no_overprovisioning in request Node (#3402)
Also set the new user-agent fields.
This commit is contained in:
Родитель
224056d331
Коммит
a63c5550c9
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module google.golang.org/grpc
|
|||
go 1.11
|
||||
|
||||
require (
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473
|
||||
github.com/envoyproxy/go-control-plane v0.9.4
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
||||
github.com/golang/mock v1.1.1
|
||||
|
|
8
go.sum
8
go.sum
|
@ -5,8 +5,11 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
|||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f h1:WBZRG4aNOuI15bLRrCgN8fCq8E5Xuty6jGbmSNEvSsU=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4 h1:rEvIZUSZ3fx39WIi3JkQqQBitGwpELBIYWeBVh6wn+E=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
|
@ -55,6 +58,7 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2El
|
|||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
|
|
@ -37,10 +37,12 @@ const (
|
|||
// Environment variable which holds the name of the xDS bootstrap file.
|
||||
fileEnv = "GRPC_XDS_BOOTSTRAP"
|
||||
// Type name for Google default credentials.
|
||||
googleDefaultCreds = "google_default"
|
||||
googleDefaultCreds = "google_default"
|
||||
gRPCUserAgentName = "gRPC Go"
|
||||
clientFeatureNoOverprovisioning = "envoy.lb.does_not_support_overprovisioning"
|
||||
)
|
||||
|
||||
var gRPCVersion = fmt.Sprintf("gRPC-Go %s", grpc.Version)
|
||||
var gRPCVersion = fmt.Sprintf("%s %s", gRPCUserAgentName, grpc.Version)
|
||||
|
||||
// For overriding in unit tests.
|
||||
var fileReadFunc = ioutil.ReadFile
|
||||
|
@ -158,7 +160,13 @@ func NewConfig() (*Config, error) {
|
|||
if config.NodeProto == nil {
|
||||
config.NodeProto = &corepb.Node{}
|
||||
}
|
||||
// BuildVersion is deprecated, and is replaced by user_agent_name and
|
||||
// user_agent_version. But the management servers are still using the old
|
||||
// field, so we will keep both set.
|
||||
config.NodeProto.BuildVersion = gRPCVersion
|
||||
config.NodeProto.UserAgentName = gRPCUserAgentName
|
||||
config.NodeProto.UserAgentVersionType = &corepb.Node_UserAgentVersion{UserAgentVersion: grpc.Version}
|
||||
config.NodeProto.ClientFeatures = append(config.NodeProto.ClientFeatures, clientFeatureNoOverprovisioning)
|
||||
|
||||
logger.Infof("Bootstrap config for creating xds-client: %+v", config)
|
||||
return config, nil
|
||||
|
|
|
@ -41,7 +41,10 @@ var (
|
|||
},
|
||||
},
|
||||
},
|
||||
BuildVersion: gRPCVersion,
|
||||
BuildVersion: gRPCVersion,
|
||||
UserAgentName: gRPCUserAgentName,
|
||||
UserAgentVersionType: &corepb.Node_UserAgentVersion{UserAgentVersion: grpc.Version},
|
||||
ClientFeatures: []string{clientFeatureNoOverprovisioning},
|
||||
}
|
||||
nilCredsConfig = &Config{
|
||||
BalancerName: "trafficdirector.googleapis.com:443",
|
||||
|
@ -233,7 +236,12 @@ func (s) TestNewConfig(t *testing.T) {
|
|||
{"badJSON", nil, true},
|
||||
{"emptyNodeProto", &Config{
|
||||
BalancerName: "trafficdirector.googleapis.com:443",
|
||||
NodeProto: &corepb.Node{BuildVersion: gRPCVersion},
|
||||
NodeProto: &corepb.Node{
|
||||
BuildVersion: gRPCVersion,
|
||||
UserAgentName: gRPCUserAgentName,
|
||||
UserAgentVersionType: &corepb.Node_UserAgentVersion{UserAgentVersion: grpc.Version},
|
||||
ClientFeatures: []string{clientFeatureNoOverprovisioning},
|
||||
},
|
||||
}, false},
|
||||
{"noBalancerName", nil, true},
|
||||
{"emptyXdsServer", nil, true},
|
||||
|
|
Загрузка…
Ссылка в новой задаче