From ba79fa21ae7929d7e4f4ef765f999a9c45e17ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraci=20Paix=C3=A3o=20Kr=C3=B6hling?= Date: Mon, 29 Aug 2022 17:10:41 -0300 Subject: [PATCH] httpgrpc/server: Update NewClient to not use WithBalancerName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On projects consuming this module as a library, gRPC might be set at newer versions where the deprecated #WithBalancerName has been removed already. Given that the version used by this module already offers a forward-compatible method, this commit uses that instead of the deprecated #WithBalancerName. This is a simplified version of #240, without touching the gRPC versions. Fixes #239 Signed-off-by: Juraci Paixão Kröhling --- httpgrpc/server/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httpgrpc/server/server.go b/httpgrpc/server/server.go index d478e18a..f84521f0 100644 --- a/httpgrpc/server/server.go +++ b/httpgrpc/server/server.go @@ -17,7 +17,6 @@ import ( "github.com/sercand/kuberesolver" "golang.org/x/net/context" "google.golang.org/grpc" - "google.golang.org/grpc/balancer/roundrobin" "github.com/weaveworks/common/httpgrpc" "github.com/weaveworks/common/logging" @@ -132,9 +131,10 @@ func NewClient(address string) (*Client, error) { if err != nil { return nil, err } + const grpcServiceConfig = `{"loadBalancingPolicy":"round_robin"}` dialOptions := []grpc.DialOption{ - grpc.WithBalancerName(roundrobin.Name), + grpc.WithDefaultServiceConfig(grpcServiceConfig), grpc.WithInsecure(), grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient( otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer()),