fix: set max msg recv size when proxying

Previously a fix was deployed in the Talos API client, but when the
request passes through `apid`, we need to make sure that proxy doesn't
reject large responses.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2023-11-09 20:50:17 +04:00
parent e22ab440d7
commit e9c7ac17a9
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811
2 changed files with 7 additions and 0 deletions

View File

@ -101,6 +101,9 @@ func (a *APID) GetConnection(ctx context.Context, fullMethodName string) (contex
// see: https://github.com/grpc/grpc-go/blob/d5dee5fdbdeb52f6ea10b37b2cc7ce37814642d7/clientconn.go#L55-L56
MinConnectTimeout: 20 * time.Second,
}),
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(constants.GRPCMaxMessageSize),
),
grpc.WithCodec(proxy.Codec()), //nolint:staticcheck
grpc.WithSharedWriteBuffer(true),
)

View File

@ -14,6 +14,7 @@ import (
"google.golang.org/grpc/metadata"
"github.com/siderolabs/talos/pkg/grpc/middleware/authz"
"github.com/siderolabs/talos/pkg/machinery/constants"
)
var _ proxy.Backend = (*Local)(nil)
@ -60,6 +61,9 @@ func (l *Local) GetConnection(ctx context.Context, fullMethodName string) (conte
ctx,
"unix:"+l.socketPath,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(constants.GRPCMaxMessageSize),
),
grpc.WithCodec(proxy.Codec()), //nolint:staticcheck
grpc.WithSharedWriteBuffer(true),
)