Skip to content

Commit 0832568

Browse files
committed
Update gRPC to v1.23.0
Includes partial cherry-pick of prior master PR: "bump google.golang.org/grpc v1.20.1" Code changes from master cherry-picked to release/1.2 for the commit 2ed8e60. The vendoring is taken from the recent CVE release of gRPC to 1.23.0 in commit eb7a6bf. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
1 parent 5fbd02f commit 0832568

File tree

100 files changed

+9022
-5458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+9022
-5458
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
101101
grpc.WithInsecure(),
102102
grpc.FailOnNonTempDialError(true),
103103
grpc.WithBackoffMaxDelay(3 * time.Second),
104-
grpc.WithDialer(dialer.Dialer),
104+
grpc.WithContextDialer(dialer.ContextDialer),
105105

106106
// TODO(stevvooe): We may need to allow configuration of this on the client.
107107
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),
@@ -196,7 +196,7 @@ func (c *Client) IsServing(ctx context.Context) (bool, error) {
196196
return false, errors.New("no grpc connection available")
197197
}
198198
c.connMu.Unlock()
199-
r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.FailFast(false))
199+
r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.WaitForReady(true))
200200
if err != nil {
201201
return false, err
202202
}

cmd/containerd/command/publish.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ func getEventPayload(r io.Reader) (*types.Any, error) {
8484
}
8585

8686
func connectEvents(address string) (eventsapi.EventsClient, error) {
87-
conn, err := connect(address, dialer.Dialer)
87+
conn, err := connect(address, dialer.ContextDialer)
8888
if err != nil {
8989
return nil, errors.Wrapf(err, "failed to dial %q", address)
9090
}
9191
return eventsapi.NewEventsClient(conn), nil
9292
}
9393

94-
func connect(address string, d func(string, time.Duration) (net.Conn, error)) (*grpc.ClientConn, error) {
94+
func connect(address string, d func(gocontext.Context, string) (net.Conn, error)) (*grpc.ClientConn, error) {
9595
gopts := []grpc.DialOption{
9696
grpc.WithBlock(),
9797
grpc.WithInsecure(),
98-
grpc.WithDialer(d),
98+
grpc.WithContextDialer(d),
9999
grpc.FailOnNonTempDialError(true),
100100
grpc.WithBackoffMaxDelay(3 * time.Second),
101101
}

pkg/dialer/dialer.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package dialer
1818

1919
import (
20+
"context"
2021
"net"
2122
"time"
2223

@@ -28,8 +29,19 @@ type dialResult struct {
2829
err error
2930
}
3031

32+
// ContextDialer returns a GRPC net.Conn connected to the provided address
33+
func ContextDialer(ctx context.Context, address string) (net.Conn, error) {
34+
if deadline, ok := ctx.Deadline(); ok {
35+
return timeoutDialer(address, time.Until(deadline))
36+
}
37+
return timeoutDialer(address, 0)
38+
}
39+
3140
// Dialer returns a GRPC net.Conn connected to the provided address
32-
func Dialer(address string, timeout time.Duration) (net.Conn, error) {
41+
// Deprecated: use ContextDialer and grpc.WithContextDialer.
42+
var Dialer = timeoutDialer
43+
44+
func timeoutDialer(address string, timeout time.Duration) (net.Conn, error) {
3345
var (
3446
stopC = make(chan struct{})
3547
synC = make(chan *dialResult)

services/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
335335
gopts := []grpc.DialOption{
336336
grpc.WithInsecure(),
337337
grpc.WithBackoffMaxDelay(3 * time.Second),
338-
grpc.WithDialer(dialer.Dialer),
338+
grpc.WithContextDialer(dialer.ContextDialer),
339339

340340
// TODO(stevvooe): We may need to allow configuration of this on the client.
341341
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ github.com/opencontainers/runc v1.0.0-rc8
2424
github.com/sirupsen/logrus v1.0.0
2525
github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
2626
golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac
27-
google.golang.org/grpc v1.12.0
27+
google.golang.org/grpc 6eaf6f47437a6b4e2153a190160ef39a92c7eceb # v1.23.0
2828
github.com/pkg/errors v0.8.0
2929
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
3030
golang.org/x/sys 41f3e6584952bb034a481797859f6ab34b6803bd https://github.com/golang/sys

vendor/google.golang.org/grpc/README.md

Lines changed: 88 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/google.golang.org/grpc/backoff.go

Lines changed: 4 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/google.golang.org/grpc/balancer.go

Lines changed: 5 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)