From 9aabe2a2b68521620f603eb286504302493b70ee Mon Sep 17 00:00:00 2001 From: Rene Zbinden Date: Tue, 30 Jan 2018 09:03:21 +0100 Subject: [PATCH 1/2] grpcproxy: configure --max-send-bytes and --max-recv-bytes for grpc proxy --- etcdmain/grpc_proxy.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/etcdmain/grpc_proxy.go b/etcdmain/grpc_proxy.go index 23cd767c2..6b0865335 100644 --- a/etcdmain/grpc_proxy.go +++ b/etcdmain/grpc_proxy.go @@ -53,6 +53,8 @@ var ( grpcProxyDNSCluster string grpcProxyInsecureDiscovery bool grpcProxyDataDir string + grpcMaxCallSendMsgSize int + grpcMaxCallRecvMsgSize int // tls for connecting to etcd @@ -115,6 +117,8 @@ func newGRPCProxyStartCommand() *cobra.Command { cmd.Flags().StringVar(&grpcProxyNamespace, "namespace", "", "string to prefix to all keys for namespacing requests") cmd.Flags().BoolVar(&grpcProxyEnablePprof, "enable-pprof", false, `Enable runtime profiling data via HTTP server. Address is at client URL + "/debug/pprof/"`) cmd.Flags().StringVar(&grpcProxyDataDir, "data-dir", "default.proxy", "Data directory for persistent data") + cmd.Flags().IntVar(&grpcMaxCallSendMsgSize, "max-send-bytes", 1.5*1024*1024, "message send limits in bytes (default value is 1.5 MiB)") + cmd.Flags().IntVar(&grpcMaxCallRecvMsgSize, "max-recv-bytes", math.MaxInt32, "message receive limits in bytes (default value is math.MaxInt32)") // client TLS for connecting to server cmd.Flags().StringVar(&grpcProxyCert, "cert", "", "identify secure connections with etcd servers using this TLS certificate file") @@ -241,6 +245,14 @@ func newClientCfg(eps []string) (*clientv3.Config, error) { Endpoints: eps, DialTimeout: 5 * time.Second, } + + if grpcMaxCallSendMsgSize > 0 { + cfg.MaxCallSendMsgSize = grpcMaxCallSendMsgSize + } + if grpcMaxCallRecvMsgSize > 0 { + cfg.MaxCallRecvMsgSize = grpcMaxCallRecvMsgSize + } + tls := newTLS(grpcProxyCA, grpcProxyCert, grpcProxyKey) if tls == nil && grpcProxyInsecureSkipTLSVerify { tls = &transport.TLSInfo{} From ab2bc5b93ca1f459e7eb0d2d0d4166761dfc3673 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 30 Jan 2018 09:31:02 -0800 Subject: [PATCH 2/2] CHANGELOG-3.3: add "grpc-proxy start --max-send/recv-bytes" flags Signed-off-by: Gyuho Lee --- CHANGELOG-3.3.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index 64ace9bc7..925440d58 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -165,6 +165,8 @@ See [code changes](https://github.com/coreos/etcd/compare/v3.2.0...v3.3.0-rc.0) - Set `--metrics-addr=http://[HOST]:9379` to serve `/metrics` in insecure port 9379. - Serve [`/health` endpoint in grpc-proxy](https://github.com/coreos/etcd/pull/8322). - Add [`grpc-proxy start --debug`](https://github.com/coreos/etcd/pull/8994) flag. +- Add [`grpc-proxy start --max-send-bytes`](https://github.com/coreos/etcd/pull/9250) flag to [configure maximum client request size](https://github.com/coreos/etcd/issues/7923). +- Add [`grpc-proxy start --max-recv-bytes`](https://github.com/coreos/etcd/pull/9250) flag to [configure maximum client request size](https://github.com/coreos/etcd/issues/7923). ### Added(gRPC gateway)