Use insecure.NewCredentials instead of grpc.WithInsecure

grpc.WithInsecure is being deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2021-12-16 22:35:57 +00:00
parent 2fb739aa21
commit 2ee3ce510c
7 changed files with 25 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ 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"
)
@@ -405,7 +406,10 @@ func RawRuntimeClient() (runtime.RuntimeServiceClient, error) {
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer))
conn, err := grpc.DialContext(ctx, addr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithContextDialer(dialer),
)
if err != nil {
return nil, errors.Wrap(err, "failed to connect cri endpoint")
}