From f8a6a2db0431fb8efb30a788e1846a7459e8d3ac Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Thu, 20 Sep 2018 16:04:47 -0700 Subject: [PATCH] set grpc dial grpclb server target to remoteLBName that comes from resolver --- balancer/grpclb/grpclb_remote_balancer.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/balancer/grpclb/grpclb_remote_balancer.go b/balancer/grpclb/grpclb_remote_balancer.go index 15b9c45a27a3..4195b2c03cb1 100644 --- a/balancer/grpclb/grpclb_remote_balancer.go +++ b/balancer/grpclb/grpclb_remote_balancer.go @@ -290,9 +290,12 @@ func (lb *lbBalancer) dialRemoteLB(remoteLBName string) { dopts = append(dopts, grpc.WithChannelzParentID(lb.opt.ChannelzParentID)) } - // DialContext using manualResolver.Scheme, which is a random scheme generated - // when init grpclb. The target name is not important. - cc, err := grpc.DialContext(context.Background(), "grpclb:///grpclb.server", dopts...) + // DialContext using manualResolver.Scheme, which is a random scheme + // generated when init grpclb. The target scheme here is not important. + // + // The grpc dial target will be used by the creds (ALTS) as the authority, + // so it has to be set to remoteLBName that comes from resolver. + cc, err := grpc.DialContext(context.Background(), remoteLBName, dopts...) if err != nil { grpclog.Fatalf("failed to dial: %v", err) }