UPSTREAM: <drop>: grpc: work around missing WithContextDialer with old grpc lib
@@ -124,14 +124,15 @@ func newETCD3Client(c storagebackend.TransportConfig) (*clientv3.Client, error)
grpc.WithStreamInterceptor(grpcprom.StreamClientInterceptor),
}
if egressDialer != nil {
- dialer := func(ctx context.Context, addr string) (net.Conn, error) {
+ dialer := func(addr string, timeout time.Duration) (net.Conn, error) {
u, err := url.Parse(addr)
if err != nil {
return nil, err
}
+ ctx, _ := context.WithTimeout(context.TODO(), timeout)
return egressDialer(ctx, "tcp", u.Host)
}
- dialOptions = append(dialOptions, grpc.WithContextDialer(dialer))
+ dialOptions = append(dialOptions, grpc.WithDialer(dialer))
}
cfg := clientv3.Config{
DialTimeout: dialTimeout,
