Skip to content

Commit

Permalink
Update grpc from v1.36.1 to v1.49.0 (#6336)
Browse files Browse the repository at this point in the history
Changelog: grpc/grpc-go@v1.36.1...v1.49.0

The biggest change for us is that grpc.WithBalancerName has
transitioned from deprecated to fully removed. The fix is to replace
it with a JSON-formatted "default config" object, as demonstrated in
grpc/grpc-go#5232 (comment).

This should unblock updating other dependencies which want to
transitively update gRPC as well.
  • Loading branch information
aarongable committed Sep 1, 2022
1 parent cba5813 commit c706609
Show file tree
Hide file tree
Showing 107 changed files with 8,711 additions and 2,437 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -33,7 +33,7 @@ require (
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
golang.org/x/text v0.3.7
google.golang.org/grpc v1.36.1
google.golang.org/grpc v1.49.0
google.golang.org/protobuf v1.28.1
gopkg.in/square/go-jose.v2 v2.6.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Expand Up @@ -837,8 +837,9 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.36.1 h1:cmUfbeGKnz9+2DD/UYsMQXeqbHZqZDs4eQwW0sFOpBY=
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
4 changes: 3 additions & 1 deletion grpc/client.go
Expand Up @@ -3,6 +3,7 @@ package grpc
import (
"crypto/tls"
"errors"
"fmt"
"net"
"strings"

Expand All @@ -16,6 +17,7 @@ import (

// Import for its init function, which causes clients to rely on the
// Health Service for load-balancing.
"google.golang.org/grpc/balancer/roundrobin"
_ "google.golang.org/grpc/health"
)

Expand Down Expand Up @@ -59,7 +61,7 @@ func ClientSetup(c *cmd.GRPCClientConfig, tlsConfig *tls.Config, metrics clientM
creds := bcreds.NewClientCredentials(tlsConfig.RootCAs, tlsConfig.Certificates, hostOverride)
return grpc.Dial(
target,
grpc.WithBalancerName("round_robin"),
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, roundrobin.Name)),
grpc.WithTransportCredentials(creds),
grpc.WithChainUnaryInterceptor(allInterceptors...),
)
Expand Down
5 changes: 3 additions & 2 deletions grpc/errors_test.go
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/jmhodges/clock"
berrors "github.com/letsencrypt/boulder/errors"
Expand Down Expand Up @@ -40,7 +41,7 @@ func TestErrorWrapping(t *testing.T) {

conn, err := grpc.Dial(
lis.Addr().String(),
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept),
)
test.AssertNotError(t, err, "Failed to dial grpc test server")
Expand Down Expand Up @@ -71,7 +72,7 @@ func TestSubErrorWrapping(t *testing.T) {

conn, err := grpc.Dial(
lis.Addr().String(),
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept),
)
test.AssertNotError(t, err, "Failed to dial grpc test server")
Expand Down
13 changes: 8 additions & 5 deletions grpc/interceptors_test.go
Expand Up @@ -3,6 +3,7 @@ package grpc
import (
"context"
"errors"
"fmt"
"log"
"net"
"net/http"
Expand All @@ -15,7 +16,9 @@ import (
"github.com/jmhodges/clock"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"

Expand Down Expand Up @@ -103,8 +106,8 @@ func TestFailFastFalse(t *testing.T) {
clk: clock.NewFake(),
}
conn, err := grpc.Dial("localhost:19876", // random, probably unused port
grpc.WithInsecure(),
grpc.WithBalancerName("round_robin"),
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, roundrobin.Name)),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept))
if err != nil {
t.Fatalf("did not connect: %v", err)
Expand Down Expand Up @@ -170,7 +173,7 @@ func TestTimeouts(t *testing.T) {
clk: clock.NewFake(),
}
conn, err := grpc.Dial(net.JoinHostPort("localhost", strconv.Itoa(port)),
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept))
if err != nil {
t.Fatalf("did not connect: %v", err)
Expand Down Expand Up @@ -232,7 +235,7 @@ func TestRequestTimeTagging(t *testing.T) {
clk: clk,
}
conn, err := grpc.Dial(net.JoinHostPort("localhost", strconv.Itoa(port)),
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept))
if err != nil {
t.Fatalf("did not connect: %v", err)
Expand Down Expand Up @@ -318,7 +321,7 @@ func TestInFlightRPCStat(t *testing.T) {
clk: clk,
}
conn, err := grpc.Dial(net.JoinHostPort("localhost", strconv.Itoa(port)),
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(ci.intercept))
if err != nil {
t.Fatalf("did not connect: %v", err)
Expand Down
5 changes: 4 additions & 1 deletion test/integration/akamai_purger_drain_queue_test.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/letsencrypt/boulder/cmd"
bcreds "github.com/letsencrypt/boulder/grpc/creds"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/connectivity"
)

Expand All @@ -31,6 +32,7 @@ func setup() (*exec.Cmd, *bytes.Buffer, akamaipb.AkamaiPurgerClient, error) {
// will never exit.
sigterm := func() {
purgerCmd.Process.Signal(syscall.SIGTERM)
purgerCmd.Wait()
}

s := func(input string) *string {
Expand All @@ -48,6 +50,7 @@ func setup() (*exec.Cmd, *bytes.Buffer, akamaipb.AkamaiPurgerClient, error) {
creds := bcreds.NewClientCredentials(tlsConfig.RootCAs, tlsConfig.Certificates, "akamai-purger.boulder")
conn, err := grpc.Dial(
"dns:///akamai-purger.boulder:9199",
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, roundrobin.Name)),
grpc.WithTransportCredentials(creds),
)
if err != nil {
Expand All @@ -60,7 +63,7 @@ func setup() (*exec.Cmd, *bytes.Buffer, akamaipb.AkamaiPurgerClient, error) {
}
if i > 40 {
sigterm()
return nil, nil, nil, fmt.Errorf("timed out waiting for akamai-purger to come up")
return nil, nil, nil, fmt.Errorf("timed out waiting for akamai-purger to come up: %s", outputBuffer.String())
}
time.Sleep(50 * time.Millisecond)
}
Expand Down

0 comments on commit c706609

Please sign in to comment.