diff --git a/docs/root/intro/version_history.rst b/docs/root/intro/version_history.rst index 720d55aac..6b3039be4 100644 --- a/docs/root/intro/version_history.rst +++ b/docs/root/intro/version_history.rst @@ -33,6 +33,8 @@ Version history :ref:`cluster specific ` options. * sockets: added `IP_TRANSPARENT` socket option support for :ref:`listeners `. +* sockets: added `SO_KEEPALIVE` socket option for upstream connections + :ref:`per cluster `. * tracing: the sampling decision is now delegated to the tracers, allowing the tracer to decide when and if to use it. For example, if the :ref:`x-b3-sampled ` header is supplied with the client request, its value will override any sampling decision made by the Envoy proxy. diff --git a/envoy/api/v2/cds.proto b/envoy/api/v2/cds.proto index 38e8f2aff..2c4764620 100644 --- a/envoy/api/v2/cds.proto +++ b/envoy/api/v2/cds.proto @@ -41,7 +41,7 @@ service ClusterDiscoveryService { // [#protodoc-title: Clusters] // Configuration for a single upstream cluster. -// [#comment:next free field: 30] +// [#comment:next free field: 31] message Cluster { // Supplies the name of the cluster which must be unique across all clusters. // The cluster name is used when emitting @@ -429,6 +429,9 @@ message Cluster { // Determines how Envoy selects the protocol used to speak to upstream hosts. ClusterProtocolSelection protocol_selection = 26; + + // Optional options for upstream connections. + envoy.api.v2.UpstreamConnectionOptions upstream_connection_options = 30; } // An extensible structure containing the address Envoy should bind to when @@ -437,3 +440,8 @@ message UpstreamBindConfig { // The address Envoy should bind to when establishing upstream connections. core.Address source_address = 1; } + +message UpstreamConnectionOptions { + // If set then set SO_KEEPALIVE on the socket to enable TCP Keepalives. + core.TcpKeepalive tcp_keepalive = 1; +} diff --git a/envoy/api/v2/core/address.proto b/envoy/api/v2/core/address.proto index bf9051a89..266bdfa8e 100644 --- a/envoy/api/v2/core/address.proto +++ b/envoy/api/v2/core/address.proto @@ -58,6 +58,20 @@ message SocketAddress { bool ipv4_compat = 6; } +message TcpKeepalive { + // Maximum number of keepalive probes to send without response before deciding + // the connection is dead. Default is to use the OS level configuration (unless + // overridden, Linux defaults to 9.) + google.protobuf.UInt32Value keepalive_probes = 1; + // The number of seconds a connection needs to be idle before keep-alive probes + // start being sent. Default is to use the OS level configuration (unless + // overridden, Linux defaults to 7200s (ie 2 hours.) + google.protobuf.UInt32Value keepalive_time = 2; + // The number of seconds between keep-alive probes. Default is to use the OS + // level configuration (unless overridden, Linux defaults to 75s.) + google.protobuf.UInt32Value keepalive_interval = 3; +} + message BindConfig { // The address to bind to when creating a socket. SocketAddress source_address = 1