Skip to content

Commit 985ed8d

Browse files
committed
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> (cherry picked from commit e9c7ac1)
1 parent 1e59138 commit 985ed8d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

internal/app/apid/pkg/backend/apid.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ func (a *APID) GetConnection(ctx context.Context, fullMethodName string) (contex
101101
// see: https://github.com/grpc/grpc-go/blob/d5dee5fdbdeb52f6ea10b37b2cc7ce37814642d7/clientconn.go#L55-L56
102102
MinConnectTimeout: 20 * time.Second,
103103
}),
104+
grpc.WithDefaultCallOptions(
105+
grpc.MaxCallRecvMsgSize(constants.GRPCMaxMessageSize),
106+
),
104107
grpc.WithCodec(proxy.Codec()), //nolint:staticcheck
105108
)
106109

pkg/grpc/proxy/backend/local.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"google.golang.org/grpc/metadata"
1515

1616
"github.com/siderolabs/talos/pkg/grpc/middleware/authz"
17+
"github.com/siderolabs/talos/pkg/machinery/constants"
1718
)
1819

1920
var _ proxy.Backend = (*Local)(nil)
@@ -60,6 +61,9 @@ func (l *Local) GetConnection(ctx context.Context, fullMethodName string) (conte
6061
ctx,
6162
"unix:"+l.socketPath,
6263
grpc.WithTransportCredentials(insecure.NewCredentials()),
64+
grpc.WithDefaultCallOptions(
65+
grpc.MaxCallRecvMsgSize(constants.GRPCMaxMessageSize),
66+
),
6367
grpc.WithCodec(proxy.Codec()), //nolint:staticcheck
6468

6569
)

0 commit comments

Comments
 (0)