1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
From: Shengjing Zhu <zhushengjing@cambricon.com>
Date: Mon, 21 Feb 2022 00:50:59 +0800
Subject: Revert "Use insecure.NewCredentials instead of grpc.WithInsecure"
This reverts commit 2ee3ce510cf26d5eb400fac118aeeec5c20ed83f.
Need golang-google-grpc-dev v1.34.0
Forwarded: not-needed
---
client.go | 3 +--
cmd/containerd/command/publish.go | 3 +--
integration/main_test.go | 6 +-----
integration/remote/remote_image.go | 7 +------
integration/remote/remote_runtime.go | 7 +------
services/server/server.go | 3 +--
6 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/client.go b/client.go
index 1c2202e..86fa787 100644
--- a/client.go
+++ b/client.go
@@ -64,7 +64,6 @@ import (
"golang.org/x/sync/semaphore"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
- "google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/health/grpc_health_v1"
)
@@ -118,7 +117,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
}
gopts := []grpc.DialOption{
grpc.WithBlock(),
- grpc.WithTransportCredentials(insecure.NewCredentials()),
+ grpc.WithInsecure(),
grpc.FailOnNonTempDialError(true),
grpc.WithConnectParams(connParams),
grpc.WithContextDialer(dialer.ContextDialer),
diff --git a/cmd/containerd/command/publish.go b/cmd/containerd/command/publish.go
index b18f19f..e138ed4 100644
--- a/cmd/containerd/command/publish.go
+++ b/cmd/containerd/command/publish.go
@@ -32,7 +32,6 @@ import (
"github.com/urfave/cli"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
- "google.golang.org/grpc/credentials/insecure"
)
var publishCommand = cli.Command{
@@ -100,7 +99,7 @@ func connect(address string, d func(gocontext.Context, string) (net.Conn, error)
}
gopts := []grpc.DialOption{
grpc.WithBlock(),
- grpc.WithTransportCredentials(insecure.NewCredentials()),
+ grpc.WithInsecure(),
grpc.WithContextDialer(d),
grpc.FailOnNonTempDialError(true),
grpc.WithConnectParams(connParams),
diff --git a/integration/main_test.go b/integration/main_test.go
index a62687c..fb8556e 100644
--- a/integration/main_test.go
+++ b/integration/main_test.go
@@ -47,7 +47,6 @@ import (
"github.com/stretchr/testify/require"
exec "golang.org/x/sys/execabs"
"google.golang.org/grpc"
- "google.golang.org/grpc/credentials/insecure"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)
@@ -507,10 +506,7 @@ func RawRuntimeClient() (runtime.RuntimeServiceClient, error) {
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
- conn, err := grpc.DialContext(ctx, addr,
- grpc.WithTransportCredentials(insecure.NewCredentials()),
- grpc.WithContextDialer(dialer),
- )
+ conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer))
if err != nil {
return nil, fmt.Errorf("failed to connect cri endpoint: %w", err)
}
diff --git a/integration/remote/remote_image.go b/integration/remote/remote_image.go
index 16088a9..a722d41 100644
--- a/integration/remote/remote_image.go
+++ b/integration/remote/remote_image.go
@@ -39,7 +39,6 @@ import (
"time"
"google.golang.org/grpc"
- "google.golang.org/grpc/credentials/insecure"
"k8s.io/klog/v2"
internalapi "github.com/containerd/containerd/integration/cri-api/pkg/apis"
@@ -65,11 +64,7 @@ func NewImageService(endpoint string, connectionTimeout time.Duration) (internal
ctx, cancel := context.WithTimeout(context.Background(), connectionTimeout)
defer cancel()
- conn, err := grpc.DialContext(ctx, addr,
- grpc.WithTransportCredentials(insecure.NewCredentials()),
- grpc.WithContextDialer(dialer),
- grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
- )
+ conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)))
if err != nil {
klog.Errorf("Connect remote image service %s failed: %v", addr, err)
return nil, err
diff --git a/integration/remote/remote_runtime.go b/integration/remote/remote_runtime.go
index b172b94..d9bd813 100644
--- a/integration/remote/remote_runtime.go
+++ b/integration/remote/remote_runtime.go
@@ -40,7 +40,6 @@ import (
"time"
"google.golang.org/grpc"
- "google.golang.org/grpc/credentials/insecure"
"k8s.io/klog/v2"
internalapi "github.com/containerd/containerd/integration/cri-api/pkg/apis"
@@ -74,11 +73,7 @@ func NewRuntimeService(endpoint string, connectionTimeout time.Duration) (intern
ctx, cancel := context.WithTimeout(context.Background(), connectionTimeout)
defer cancel()
- conn, err := grpc.DialContext(ctx, addr,
- grpc.WithTransportCredentials(insecure.NewCredentials()),
- grpc.WithContextDialer(dialer),
- grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
- )
+ conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)))
if err != nil {
klog.Errorf("Connect remote runtime %s failed: %v", addr, err)
return nil, err
diff --git a/services/server/server.go b/services/server/server.go
index b6ea8cf..614591f 100644
--- a/services/server/server.go
+++ b/services/server/server.go
@@ -58,7 +58,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/credentials"
- "google.golang.org/grpc/credentials/insecure"
)
const (
@@ -540,7 +539,7 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
Backoff: backoffConfig,
}
gopts := []grpc.DialOption{
- grpc.WithTransportCredentials(insecure.NewCredentials()),
+ grpc.WithInsecure(),
grpc.WithConnectParams(connParams),
grpc.WithContextDialer(dialer.ContextDialer),
|