Skip to content

Commit 29d1f6f

Browse files
authored
Merge pull request #927 from qiutongs/fix-grpc-size
Use same grpc max message size as Kubelet
2 parents d82b602 + 132b50d commit 29d1f6f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/crictl/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import (
3838

3939
const (
4040
defaultTimeout = 2 * time.Second
41+
// use same message size as cri remote client in kubelet.
42+
maxMsgSize = 1024 * 1024 * 16
4143
)
4244

4345
var (
@@ -115,7 +117,7 @@ func getConnection(endPoints []string) (*grpc.ClientConn, error) {
115117
logrus.Error(err)
116118
continue
117119
}
118-
conn, err = grpc.Dial(addr, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(Timeout), grpc.WithContextDialer(dialer))
120+
conn, err = grpc.Dial(addr, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(Timeout), grpc.WithContextDialer(dialer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)))
119121
if err != nil {
120122
errMsg := errors.Wrapf(err, "connect endpoint '%s', make sure you are running as root and the endpoint has been started", endPoint)
121123
if indx == endPointsLen-1 {

0 commit comments

Comments
 (0)