From 79716fa1127a80fd9931c605240336badea5ac91 Mon Sep 17 00:00:00 2001 From: shihuixing Date: Mon, 5 Feb 2024 11:13:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?added=20dial-keepalive-time=E3=80=81dial-ke?= =?UTF-8?q?epalive-timeout=E3=80=81permit-without-stream=20arguments=20to?= =?UTF-8?q?=20the=20grpc-proxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shihuixing --- server/etcdmain/grpc_proxy.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index 6ba45db7f..e88941465 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -62,6 +62,9 @@ var ( grpcProxyMetricsListenAddr string grpcProxyEndpoints []string grpcProxyEndpointsAutoSyncInterval time.Duration + grpcProxyDialKeepAliveTime time.Duration + grpcProxyDialKeepAliveTimeout time.Duration + grpcProxyPermitWithoutStream bool grpcProxyDNSCluster string grpcProxyDNSClusterServiceName string grpcProxyInsecureDiscovery bool @@ -138,6 +141,9 @@ func newGRPCProxyStartCommand() *cobra.Command { cmd.Flags().BoolVar(&grpcProxyInsecureDiscovery, "insecure-discovery", false, "accept insecure SRV records") cmd.Flags().StringSliceVar(&grpcProxyEndpoints, "endpoints", []string{"127.0.0.1:2379"}, "comma separated etcd cluster endpoints") cmd.Flags().DurationVar(&grpcProxyEndpointsAutoSyncInterval, "endpoints-auto-sync-interval", 0, "etcd endpoints auto sync interval (disabled by default)") + cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTime, "dial-keepalive-time", 0, "after a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive (0 to disable).") + cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTimeout, "dial-keepalive-timeout", embed.DefaultGRPCKeepAliveTimeout, "after having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed (default 20s).") + cmd.Flags().BoolVar(&grpcProxyPermitWithoutStream, "permit-without-stream", false, "if true, client sends keepalive pings even with no active RPCs. if false, when there are no active RPCs, Time and Timeout will be ignored and no keepalive pings will be sent (default false).") cmd.Flags().StringVar(&grpcProxyAdvertiseClientURL, "advertise-client-url", "127.0.0.1:23790", "advertise address to register (must be reachable by client)") cmd.Flags().StringVar(&grpcProxyResolverPrefix, "resolver-prefix", "", "prefix to use for registering proxy (must be shared with other grpc-proxy members)") cmd.Flags().IntVar(&grpcProxyResolverTTL, "resolver-ttl", 0, "specify TTL, in seconds, when registering proxy endpoints") @@ -361,6 +367,13 @@ func newClientCfg(lg *zap.Logger, eps []string) (*clientv3.Config, error) { if grpcMaxCallRecvMsgSize > 0 { cfg.MaxCallRecvMsgSize = grpcMaxCallRecvMsgSize } + if grpcProxyDialKeepAliveTime > 0 { + cfg.DialKeepAliveTime = grpcProxyDialKeepAliveTime + } + if grpcProxyDialKeepAliveTimeout > 0 { + cfg.DialKeepAliveTimeout = grpcProxyDialKeepAliveTimeout + } + cfg.PermitWithoutStream = grpcProxyPermitWithoutStream tls := newTLS(grpcProxyCA, grpcProxyCert, grpcProxyKey, true) if tls == nil && grpcProxyInsecureSkipTLSVerify { From cf296a0b3820dbf099fc446bbf16d870dd87b2b3 Mon Sep 17 00:00:00 2001 From: shihuixing Date: Thu, 8 Feb 2024 14:45:51 +0800 Subject: [PATCH 2/4] improve description for grpc-proxy keepalive arguments Signed-off-by: shihuixing --- server/etcdmain/grpc_proxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index e88941465..85233f0b5 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -141,9 +141,9 @@ func newGRPCProxyStartCommand() *cobra.Command { cmd.Flags().BoolVar(&grpcProxyInsecureDiscovery, "insecure-discovery", false, "accept insecure SRV records") cmd.Flags().StringSliceVar(&grpcProxyEndpoints, "endpoints", []string{"127.0.0.1:2379"}, "comma separated etcd cluster endpoints") cmd.Flags().DurationVar(&grpcProxyEndpointsAutoSyncInterval, "endpoints-auto-sync-interval", 0, "etcd endpoints auto sync interval (disabled by default)") - cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTime, "dial-keepalive-time", 0, "after a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive (0 to disable).") - cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTimeout, "dial-keepalive-timeout", embed.DefaultGRPCKeepAliveTimeout, "after having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed (default 20s).") - cmd.Flags().BoolVar(&grpcProxyPermitWithoutStream, "permit-without-stream", false, "if true, client sends keepalive pings even with no active RPCs. if false, when there are no active RPCs, Time and Timeout will be ignored and no keepalive pings will be sent (default false).") + cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTime, "dial-keepalive-time", 0, "keepalive time for client(grpc-proxy) connections (default 0, disable).") + cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTimeout, "dial-keepalive-timeout", embed.DefaultGRPCKeepAliveTimeout, "keepalive timeout for client(grpc-proxy) connections (default 20s).") + cmd.Flags().BoolVar(&grpcProxyPermitWithoutStream, "permit-without-stream", false, "if true, client(grpc-proxy) sends keepalive pings even with no active RPCs (default false).") cmd.Flags().StringVar(&grpcProxyAdvertiseClientURL, "advertise-client-url", "127.0.0.1:23790", "advertise address to register (must be reachable by client)") cmd.Flags().StringVar(&grpcProxyResolverPrefix, "resolver-prefix", "", "prefix to use for registering proxy (must be shared with other grpc-proxy members)") cmd.Flags().IntVar(&grpcProxyResolverTTL, "resolver-ttl", 0, "specify TTL, in seconds, when registering proxy endpoints") From 385088944201f42de63d62b7b01fa71f6fa0ee83 Mon Sep 17 00:00:00 2001 From: shihuixing Date: Fri, 9 Feb 2024 15:14:27 +0800 Subject: [PATCH 3/4] improve description and update CHANGELOG-3.5.md Signed-off-by: shihuixing --- CHANGELOG/CHANGELOG-3.5.md | 6 ++++++ server/etcdmain/grpc_proxy.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG/CHANGELOG-3.5.md b/CHANGELOG/CHANGELOG-3.5.md index 5f0b66e22..afd5e16e1 100644 --- a/CHANGELOG/CHANGELOG-3.5.md +++ b/CHANGELOG/CHANGELOG-3.5.md @@ -18,6 +18,12 @@ Previous change logs can be found at [CHANGELOG-3.4](https://github.com/etcd-io/ - Compile binaries using [go 1.20.13](https://github.com/etcd-io/etcd/pull/17275) - Upgrade [golang.org/x/crypto to v0.17+ to address CVE-2023-48795](https://github.com/etcd-io/etcd/pull/17346) +### etcd grpc-proxy + +- Add [`etcd grpc-proxy start --dial-keepalive-time`](https://github.com/etcd-io/etcd/pull/17366) flag to keepalive time for client(grpc-proxy) connections. +- Add [`etcd grpc-proxy start --dial-keepalive-timeout`](https://github.com/etcd-io/etcd/pull/17366) flag to keepalive timeout for client(grpc-proxy) connections. +- Add [`etcd grpc-proxy start --permit-without-stream`](https://github.com/etcd-io/etcd/pull/17366) flag to enable client(grpc-proxy) to send keepalive pings even with no active RPCs. + ## v3.5.11 (2023-12-07) ### etcd server diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index 85233f0b5..f3c789f5f 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -143,7 +143,7 @@ func newGRPCProxyStartCommand() *cobra.Command { cmd.Flags().DurationVar(&grpcProxyEndpointsAutoSyncInterval, "endpoints-auto-sync-interval", 0, "etcd endpoints auto sync interval (disabled by default)") cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTime, "dial-keepalive-time", 0, "keepalive time for client(grpc-proxy) connections (default 0, disable).") cmd.Flags().DurationVar(&grpcProxyDialKeepAliveTimeout, "dial-keepalive-timeout", embed.DefaultGRPCKeepAliveTimeout, "keepalive timeout for client(grpc-proxy) connections (default 20s).") - cmd.Flags().BoolVar(&grpcProxyPermitWithoutStream, "permit-without-stream", false, "if true, client(grpc-proxy) sends keepalive pings even with no active RPCs (default false).") + cmd.Flags().BoolVar(&grpcProxyPermitWithoutStream, "permit-without-stream", false, "Enable client(grpc-proxy) to send keepalive pings even with no active RPCs.") cmd.Flags().StringVar(&grpcProxyAdvertiseClientURL, "advertise-client-url", "127.0.0.1:23790", "advertise address to register (must be reachable by client)") cmd.Flags().StringVar(&grpcProxyResolverPrefix, "resolver-prefix", "", "prefix to use for registering proxy (must be shared with other grpc-proxy members)") cmd.Flags().IntVar(&grpcProxyResolverTTL, "resolver-ttl", 0, "specify TTL, in seconds, when registering proxy endpoints") From 62cc04ff05d2562b5466a5a7efa8d3d05a490be3 Mon Sep 17 00:00:00 2001 From: shihuixing Date: Fri, 9 Feb 2024 21:13:37 +0800 Subject: [PATCH 4/4] rollback the CHANGELOG-3.5.md Signed-off-by: shihuixing --- CHANGELOG/CHANGELOG-3.5.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG/CHANGELOG-3.5.md b/CHANGELOG/CHANGELOG-3.5.md index afd5e16e1..5f0b66e22 100644 --- a/CHANGELOG/CHANGELOG-3.5.md +++ b/CHANGELOG/CHANGELOG-3.5.md @@ -18,12 +18,6 @@ Previous change logs can be found at [CHANGELOG-3.4](https://github.com/etcd-io/ - Compile binaries using [go 1.20.13](https://github.com/etcd-io/etcd/pull/17275) - Upgrade [golang.org/x/crypto to v0.17+ to address CVE-2023-48795](https://github.com/etcd-io/etcd/pull/17346) -### etcd grpc-proxy - -- Add [`etcd grpc-proxy start --dial-keepalive-time`](https://github.com/etcd-io/etcd/pull/17366) flag to keepalive time for client(grpc-proxy) connections. -- Add [`etcd grpc-proxy start --dial-keepalive-timeout`](https://github.com/etcd-io/etcd/pull/17366) flag to keepalive timeout for client(grpc-proxy) connections. -- Add [`etcd grpc-proxy start --permit-without-stream`](https://github.com/etcd-io/etcd/pull/17366) flag to enable client(grpc-proxy) to send keepalive pings even with no active RPCs. - ## v3.5.11 (2023-12-07) ### etcd server