mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-08 16:24:51 -04:00
Change grpc's max sent/recv size to a very large value. (#3912)
This commit is contained in:
parent
acc37c3cc9
commit
85c7b528e2
4 changed files with 23 additions and 6 deletions
12
logical/plugin/grpc_backend.go
Normal file
12
logical/plugin/grpc_backend.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package plugin
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
var largeMsgGRPCCallOpts []grpc.CallOption = []grpc.CallOption{
|
||||
grpc.MaxCallSendMsgSize(math.MaxInt32),
|
||||
grpc.MaxCallRecvMsgSize(math.MaxInt32),
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ func (b *backendGRPCPluginClient) HandleRequest(ctx context.Context, req *logica
|
|||
|
||||
reply, err := b.client.HandleRequest(ctx, &pb.HandleRequestArgs{
|
||||
Request: protoReq,
|
||||
})
|
||||
}, largeMsgGRPCCallOpts...)
|
||||
if err != nil {
|
||||
if b.doneCtx.Err() != nil {
|
||||
return nil, ErrPluginShutdown
|
||||
|
|
@ -115,7 +115,7 @@ func (b *backendGRPCPluginClient) HandleExistenceCheck(ctx context.Context, req
|
|||
defer cancel()
|
||||
reply, err := b.client.HandleExistenceCheck(ctx, &pb.HandleExistenceCheckArgs{
|
||||
Request: protoReq,
|
||||
})
|
||||
}, largeMsgGRPCCallOpts...)
|
||||
if err != nil {
|
||||
if b.doneCtx.Err() != nil {
|
||||
return false, false, ErrPluginShutdown
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type GRPCStorageClient struct {
|
|||
func (s *GRPCStorageClient) List(ctx context.Context, prefix string) ([]string, error) {
|
||||
reply, err := s.client.List(ctx, &pb.StorageListArgs{
|
||||
Prefix: prefix,
|
||||
})
|
||||
}, largeMsgGRPCCallOpts...)
|
||||
if err != nil {
|
||||
return reply.Keys, err
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ func (s *GRPCStorageClient) List(ctx context.Context, prefix string) ([]string,
|
|||
func (s *GRPCStorageClient) Get(ctx context.Context, key string) (*logical.StorageEntry, error) {
|
||||
reply, err := s.client.Get(ctx, &pb.StorageGetArgs{
|
||||
Key: key,
|
||||
})
|
||||
}, largeMsgGRPCCallOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ func (s *GRPCStorageClient) Get(ctx context.Context, key string) (*logical.Stora
|
|||
func (s *GRPCStorageClient) Put(ctx context.Context, entry *logical.StorageEntry) error {
|
||||
reply, err := s.client.Put(ctx, &pb.StoragePutArgs{
|
||||
Entry: pb.LogicalStorageEntryToProtoStorageEntry(entry),
|
||||
})
|
||||
}, largeMsgGRPCCallOpts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
math "math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -263,7 +264,11 @@ func (c *Core) refreshRequestForwardingConnection(ctx context.Context, clusterAd
|
|||
grpc.WithInsecure(), // it's not, we handle it in the dialer
|
||||
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||
Time: 2 * HeartbeatInterval,
|
||||
}))
|
||||
}),
|
||||
grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallRecvMsgSize(math.MaxInt32),
|
||||
grpc.MaxCallSendMsgSize(math.MaxInt32),
|
||||
))
|
||||
if err != nil {
|
||||
cancelFunc()
|
||||
c.logger.Error("core: err setting up forwarding rpc client", "error", err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue