socket: add SO_KEEPALIVE option for upstream connections. (#3042)

Adds TCP Keepalive support for upstream connections. This can be configured on the cluster manager level, and overridden on the cluster level.

Risk Level: Medium

Testing:
Unit tests have been added. It appears to run and work.

Docs Changes:
envoyproxy/data-plane-api#614

Fixes envoyproxy/envoy#3028

API Changes:
envoyproxy/data-plane-api#614

Signed-off-by: Jonathan Oddy <jonathan.oddy@transferwise.com>

Mirrored from https://github.com/envoyproxy/envoy @ dd953f99945bb7c6b3251f71bffe252a5f6e9e62
pull/620/head
data-plane-api(CircleCI) 7 years ago
parent 6775423c62
commit a9305063ca
  1. 10
      envoy/api/v2/cds.proto
  2. 14
      envoy/api/v2/core/address.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
@ -428,6 +428,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
@ -436,3 +439,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;
}

@ -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

Loading…
Cancel
Save