From 794df093f42597a846d62cac192bbce90f683ca6 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Tue, 23 Aug 2022 16:59:47 -0400 Subject: [PATCH 01/13] Add idleTimeout --- agent/config/runtime_test.go | 1 + agent/proxycfg/testing_upstreams.go | 9 ++++++ agent/structs/config_entry_discoverychain.go | 16 +++++++++ agent/structs/config_entry_test.go | 2 ++ agent/xds/config.go | 5 +++ agent/xds/config_test.go | 34 +++++++++++++++++++- agent/xds/listeners.go | 10 +++++- api/config_entry_discoverychain.go | 12 +++++++ api/config_entry_test.go | 2 ++ command/helpers/helpers_test.go | 3 ++ 10 files changed, 92 insertions(+), 2 deletions(-) diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index e0266811e38d..c4425842495c 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -4201,6 +4201,7 @@ func TestLoad_IntegrationWithFlags(t *testing.T) { Partition: acl.DefaultPartitionName, PrefixRewrite: "/alternate", RequestTimeout: 99 * time.Second, + IdleTimeout: 99 * time.Second, NumRetries: 12345, RetryOnConnectFailure: true, RetryOnStatusCodes: []uint32{401, 209}, diff --git a/agent/proxycfg/testing_upstreams.go b/agent/proxycfg/testing_upstreams.go index 2d80c0968d22..e1c2900e0760 100644 --- a/agent/proxycfg/testing_upstreams.go +++ b/agent/proxycfg/testing_upstreams.go @@ -619,6 +619,15 @@ func setupTestVariationDiscoveryChain( RequestTimeout: 33 * time.Second, }, }, + { + Match: httpMatch(&structs.ServiceRouteHTTPMatch{ + PathPrefix: "/timeout", + }), + Destination: &structs.ServiceRouteDestination{ + Service: "idle-timeout", + IdleTimeout: 33 * time.Second, + }, + }, { Match: httpMatch(&structs.ServiceRouteHTTPMatch{ PathPrefix: "/retry-connect", diff --git a/agent/structs/config_entry_discoverychain.go b/agent/structs/config_entry_discoverychain.go index 0ea2609551d6..858106b397bf 100644 --- a/agent/structs/config_entry_discoverychain.go +++ b/agent/structs/config_entry_discoverychain.go @@ -400,6 +400,10 @@ type ServiceRouteDestination struct { // downstream request (and retries) to be processed. RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` + // IdleTimeout is the total amount of time permitted for the entire + // downstream request (and retries) to be processed. + IdleTimeout time.Duration `json:",omitempty" alias:"idle_timeout"` + // NumRetries is the number of times to retry the request when a retryable // result occurs. This seems fairly proxy agnostic. NumRetries uint32 `json:",omitempty" alias:"num_retries"` @@ -422,15 +426,21 @@ func (e *ServiceRouteDestination) MarshalJSON() ([]byte, error) { type Alias ServiceRouteDestination exported := &struct { RequestTimeout string `json:",omitempty"` + IdleTimeout string `json:",omitempty"` *Alias }{ RequestTimeout: e.RequestTimeout.String(), + IdleTimeout: e.IdleTimeout.String(), Alias: (*Alias)(e), } if e.RequestTimeout == 0 { exported.RequestTimeout = "" } + if e.IdleTimeout == 0 { + exported.IdleTimeout = "" + } + return json.Marshal(exported) } @@ -438,6 +448,7 @@ func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error { type Alias ServiceRouteDestination aux := &struct { RequestTimeout string + IdleTimeout string *Alias }{ Alias: (*Alias)(e), @@ -451,6 +462,11 @@ func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error { return err } } + if aux.IdleTimeout != "" { + if e.IdleTimeout, err = time.ParseDuration(aux.IdleTimeout); err != nil { + return err + } + } return nil } diff --git a/agent/structs/config_entry_test.go b/agent/structs/config_entry_test.go index e462f6aa7476..178b2db05909 100644 --- a/agent/structs/config_entry_test.go +++ b/agent/structs/config_entry_test.go @@ -695,6 +695,7 @@ func TestDecodeConfigEntry(t *testing.T) { Namespace = "leek" PrefixRewrite = "/alternate" RequestTimeout = "99s" + IdleTimeout = "99s" NumRetries = 12345 RetryOnConnectFailure = true RetryOnStatusCodes = [401, 209] @@ -796,6 +797,7 @@ func TestDecodeConfigEntry(t *testing.T) { Namespace: "leek", PrefixRewrite: "/alternate", RequestTimeout: 99 * time.Second, + IdleTimeout: 99 * time.Second, NumRetries: 12345, RetryOnConnectFailure: true, RetryOnStatusCodes: []uint32{401, 209}, diff --git a/agent/xds/config.go b/agent/xds/config.go index 2fdf9d115e5c..02ade6da7352 100644 --- a/agent/xds/config.go +++ b/agent/xds/config.go @@ -43,6 +43,11 @@ type ProxyConfig struct { // respected (15s) LocalRequestTimeoutMs *int `mapstructure:"local_request_timeout_ms"` + // LocalRequestTimeoutMs is the number of milliseconds to timeout HTTP requests + // to the local app instance. If not set, no value is set, Envoy defaults are + // respected (15s) + LocalIdleTimeoutMs *int `mapstructure:"local_idle_timeout_ms"` + // Protocol describes the service's protocol. Valid values are "tcp", // "http" and "grpc". Anything else is treated as tcp. This enables // protocol aware features like per-request metrics and connection diff --git a/agent/xds/config_test.go b/agent/xds/config_test.go index d683e61d9ebc..4cda0255693b 100644 --- a/agent/xds/config_test.go +++ b/agent/xds/config_test.go @@ -157,7 +157,39 @@ func TestParseProxyConfig(t *testing.T) { Protocol: "tcp", }, }, - } + { + name: "local idle timeout override, float ", + input: map[string]interface{}{ + "local_idle_timeout_ms": float64(1000.0), + }, + want: ProxyConfig{ + LocalConnectTimeoutMs: 5000, + LocalIdleTimeoutMs: intPointer(1000), + Protocol: "tcp", + }, + }, + { + name: "local idle timeout override, int ", + input: map[string]interface{}{ + "local_idle_timeout_ms": 1000, + }, + want: ProxyConfig{ + LocalConnectTimeoutMs: 5000, + LocalIdleTimeoutMs: intPointer(1000), + Protocol: "tcp", + }, + }, + { + name: "local idle timeout override, string", + input: map[string]interface{}{ + "local_idle_timeout_ms": "1000", + }, + want: ProxyConfig{ + LocalConnectTimeoutMs: 5000, + LocalIdleTimeoutMs: intPointer(1000), + Protocol: "tcp", + }, + }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ParseProxyConfig(tt.input) diff --git a/agent/xds/listeners.go b/agent/xds/listeners.go index 95b84c94cec6..56027f63fd5e 100644 --- a/agent/xds/listeners.go +++ b/agent/xds/listeners.go @@ -3,7 +3,6 @@ package xds import ( "errors" "fmt" - envoy_extensions_filters_listener_http_inspector_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/http_inspector/v3" "net" "net/url" "regexp" @@ -12,6 +11,8 @@ import ( "strings" "time" + envoy_extensions_filters_listener_http_inspector_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/http_inspector/v3" + envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" envoy_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" @@ -1194,6 +1195,7 @@ func (s *ResourceGenerator) makeInboundListener(cfgSnap *proxycfg.ConfigSnapshot routeName: name, cluster: LocalAppClusterName, requestTimeoutMs: cfg.LocalRequestTimeoutMs, + idleTimeoutMs: cfg.LocalIdleTimeoutMs, } if useHTTPFilter { filterOpts.httpAuthzFilter, err = makeRBACHTTPFilter( @@ -1940,6 +1942,7 @@ type listenerFilterOpts struct { statPrefix string routePath string requestTimeoutMs *int + idleTimeoutMs *int ingressGateway bool httpAuthzFilter *envoy_http_v3.HttpFilter forwardClientDetails bool @@ -2067,6 +2070,11 @@ func makeHTTPFilter(opts listenerFilterOpts) (*envoy_listener_v3.Filter, error) r.Timeout = durationpb.New(time.Duration(*opts.requestTimeoutMs) * time.Millisecond) } + if opts.idleTimeoutMs != nil { + r := route.GetRoute() + r.IdleTimeout = durationpb.New(time.Duration(*opts.idleTimeoutMs) * time.Millisecond) + } + // If a path is provided, do not match on a catch-all prefix if opts.routePath != "" { route.Match.PathSpecifier = &envoy_route_v3.RouteMatch_Path{Path: opts.routePath} diff --git a/api/config_entry_discoverychain.go b/api/config_entry_discoverychain.go index fb22baabdba3..3af4119ead8c 100644 --- a/api/config_entry_discoverychain.go +++ b/api/config_entry_discoverychain.go @@ -69,6 +69,7 @@ type ServiceRouteDestination struct { Partition string `json:",omitempty"` PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"` RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` + IdleTimeout time.Duration `json:",omitempty" alias:"idle_timeout"` NumRetries uint32 `json:",omitempty" alias:"num_retries"` RetryOnConnectFailure bool `json:",omitempty" alias:"retry_on_connect_failure"` RetryOnStatusCodes []uint32 `json:",omitempty" alias:"retry_on_status_codes"` @@ -80,14 +81,19 @@ func (e *ServiceRouteDestination) MarshalJSON() ([]byte, error) { type Alias ServiceRouteDestination exported := &struct { RequestTimeout string `json:",omitempty"` + IdleTimeout string `json:",omitempty"` *Alias }{ RequestTimeout: e.RequestTimeout.String(), + IdleTimeout: e.IdleTimeout.String(), Alias: (*Alias)(e), } if e.RequestTimeout == 0 { exported.RequestTimeout = "" } + if e.IdleTimeout == 0 { + exported.IdleTimeout = "" + } return json.Marshal(exported) } @@ -96,6 +102,7 @@ func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error { type Alias ServiceRouteDestination aux := &struct { RequestTimeout string + IdleTimeout string *Alias }{ Alias: (*Alias)(e), @@ -109,6 +116,11 @@ func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error { return err } } + if aux.IdleTimeout != "" { + if e.IdleTimeout, err = time.ParseDuration(aux.IdleTimeout); err != nil { + return err + } + } return nil } diff --git a/api/config_entry_test.go b/api/config_entry_test.go index 63aba11b8a16..1c362e9cced9 100644 --- a/api/config_entry_test.go +++ b/api/config_entry_test.go @@ -600,6 +600,7 @@ func TestDecodeConfigEntry(t *testing.T) { "Namespace": "leek", "PrefixRewrite": "/alternate", "RequestTimeout": "99s", + "IdleTimeout": "99s", "NumRetries": 12345, "RetryOnConnectFailure": true, "RetryOnStatusCodes": [401, 209] @@ -684,6 +685,7 @@ func TestDecodeConfigEntry(t *testing.T) { Namespace: "leek", PrefixRewrite: "/alternate", RequestTimeout: 99 * time.Second, + IdleTimeout: 99 * time.Second, NumRetries: 12345, RetryOnConnectFailure: true, RetryOnStatusCodes: []uint32{401, 209}, diff --git a/command/helpers/helpers_test.go b/command/helpers/helpers_test.go index bbf64929617d..ab90f0f8dac0 100644 --- a/command/helpers/helpers_test.go +++ b/command/helpers/helpers_test.go @@ -906,6 +906,7 @@ func TestParseConfigEntry(t *testing.T) { Partition = "chard" PrefixRewrite = "/alternate" RequestTimeout = "99s" + IdleTimeout = "99s" NumRetries = 12345 RetryOnConnectFailure = true RetryOnStatusCodes = [401, 209] @@ -1085,6 +1086,7 @@ func TestParseConfigEntry(t *testing.T) { "Partition": "chard", "PrefixRewrite": "/alternate", "RequestTimeout": "99s", + "IdleTimeout": "99s", "NumRetries": 12345, "RetryOnConnectFailure": true, "RetryOnStatusCodes": [ @@ -1177,6 +1179,7 @@ func TestParseConfigEntry(t *testing.T) { Partition: "chard", PrefixRewrite: "/alternate", RequestTimeout: 99 * time.Second, + IdleTimeout: 99 * time.Second, NumRetries: 12345, RetryOnConnectFailure: true, RetryOnStatusCodes: []uint32{401, 209}, From 5b35a2e6667ab5be5ae423ec30e62edddd5c5c2f Mon Sep 17 00:00:00 2001 From: James Oulman Date: Tue, 23 Aug 2022 17:41:32 -0400 Subject: [PATCH 02/13] add idle_timeout --- agent/structs/config_entry_test.go | 1 + agent/xds/routes.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/agent/structs/config_entry_test.go b/agent/structs/config_entry_test.go index 178b2db05909..c2fc837d16b7 100644 --- a/agent/structs/config_entry_test.go +++ b/agent/structs/config_entry_test.go @@ -594,6 +594,7 @@ func TestDecodeConfigEntry(t *testing.T) { namespace = "leek" prefix_rewrite = "/alternate" request_timeout = "99s" + idle_timeout = "99s" num_retries = 12345 retry_on_connect_failure = true retry_on_status_codes = [401, 209] diff --git a/agent/xds/routes.go b/agent/xds/routes.go index 321faa5cdee6..30dbbbc3f1ff 100644 --- a/agent/xds/routes.go +++ b/agent/xds/routes.go @@ -565,6 +565,10 @@ func makeUpstreamRouteForDiscoveryChain( routeAction.Route.Timeout = durationpb.New(destination.RequestTimeout) } + if destination.IdleTimeout > 0 { + routeAction.Route.IdleTimeout = durationpb.New(destination.IdleTimeout) + } + if destination.HasRetryFeatures() { retryPolicy := &envoy_route_v3.RetryPolicy{} if destination.NumRetries > 0 { From b6c6c0ead670cceaf694222c4c607d9754bc452f Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 00:42:07 -0400 Subject: [PATCH 03/13] fix tests --- agent/config/runtime_test.go | 2 ++ agent/proxycfg/testing_upstreams.go | 2 +- .../connect-proxy-with-chain-and-router.latest.golden | 11 ++++++++++- ...s-with-chain-and-router-header-manip.latest.golden | 11 ++++++++++- .../ingress-with-chain-and-router.latest.golden | 11 ++++++++++- command/helpers/helpers_test.go | 2 ++ .../docs/connect/config-entries/service-router.mdx | 6 ++++++ 7 files changed, 41 insertions(+), 4 deletions(-) diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index c4425842495c..563979f6fa35 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -4024,6 +4024,7 @@ func TestLoad_IntegrationWithFlags(t *testing.T) { "namespace" : "leek", "prefix_rewrite" : "/alternate", "request_timeout" : "99s", + "idle_timeout" : "99s", "num_retries" : 12345, "retry_on_connect_failure": true, "retry_on_status_codes" : [401, 209] @@ -4112,6 +4113,7 @@ func TestLoad_IntegrationWithFlags(t *testing.T) { namespace = "leek" prefix_rewrite = "/alternate" request_timeout = "99s" + idle_timeout = "99s" num_retries = 12345 retry_on_connect_failure = true retry_on_status_codes = [401, 209] diff --git a/agent/proxycfg/testing_upstreams.go b/agent/proxycfg/testing_upstreams.go index e1c2900e0760..d9f9ea3ee62c 100644 --- a/agent/proxycfg/testing_upstreams.go +++ b/agent/proxycfg/testing_upstreams.go @@ -621,7 +621,7 @@ func setupTestVariationDiscoveryChain( }, { Match: httpMatch(&structs.ServiceRouteHTTPMatch{ - PathPrefix: "/timeout", + PathPrefix: "/idle-timeout", }), Destination: &structs.ServiceRouteDestination{ Service: "idle-timeout", diff --git a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden index 5f48cd972056..4c8b9635859a 100644 --- a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden @@ -274,6 +274,15 @@ "timeout": "33s" } }, + { + "match": { + "prefix": "/idle-timeout" + }, + "route": { + "cluster": "idle-timeout.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "idleTimeout": "33s" + } + }, { "match": { "prefix": "/retry-connect" @@ -405,4 +414,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden index 4f4ade54cb82..2a4d47de64b3 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden @@ -275,6 +275,15 @@ "timeout": "33s" } }, + { + "match": { + "prefix": "/idle-timeout" + }, + "route": { + "cluster": "idle-timeout.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "idleTimeout": "33s" + } + }, { "match": { "prefix": "/retry-connect" @@ -444,4 +453,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden index 06a8dcc8404c..ece3692b3771 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden @@ -275,6 +275,15 @@ "timeout": "33s" } }, + { + "match": { + "prefix": "/idle-timeout" + }, + "route": { + "cluster": "idle-timeout.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul", + "idleTimeout": "33s" + } + }, { "match": { "prefix": "/retry-connect" @@ -406,4 +415,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} \ No newline at end of file +} diff --git a/command/helpers/helpers_test.go b/command/helpers/helpers_test.go index ab90f0f8dac0..b6252ad92342 100644 --- a/command/helpers/helpers_test.go +++ b/command/helpers/helpers_test.go @@ -821,6 +821,7 @@ func TestParseConfigEntry(t *testing.T) { partition = "chard" prefix_rewrite = "/alternate" request_timeout = "99s" + idle_timeout = "99s" num_retries = 12345 retry_on_connect_failure = true retry_on_status_codes = [401, 209] @@ -993,6 +994,7 @@ func TestParseConfigEntry(t *testing.T) { "partition": "chard", "prefix_rewrite": "/alternate", "request_timeout": "99s", + "idle_timeout": "99s", "num_retries": 12345, "retry_on_connect_failure": true, "retry_on_status_codes": [ diff --git a/website/content/docs/connect/config-entries/service-router.mdx b/website/content/docs/connect/config-entries/service-router.mdx index a3f9ed81bd84..01d2884b79d6 100644 --- a/website/content/docs/connect/config-entries/service-router.mdx +++ b/website/content/docs/connect/config-entries/service-router.mdx @@ -692,6 +692,12 @@ spec: description: 'The total amount of time permitted for the entire downstream request (and retries) to be processed.', }, + { + name: 'IdleTimeout', + type: 'duration: 0', + description: + 'The total amount of time permitted for the request stream to be idle', + }, { name: 'NumRetries', type: 'int: 0', From b218c99c80169c47dce701d2645fc10acafda2b0 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 01:06:07 -0400 Subject: [PATCH 04/13] add docs for local_request_timeout_ms --- agent/xds/config.go | 4 ++-- website/content/docs/connect/proxies/envoy.mdx | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/agent/xds/config.go b/agent/xds/config.go index 02ade6da7352..58ab6ac54f1e 100644 --- a/agent/xds/config.go +++ b/agent/xds/config.go @@ -43,9 +43,9 @@ type ProxyConfig struct { // respected (15s) LocalRequestTimeoutMs *int `mapstructure:"local_request_timeout_ms"` - // LocalRequestTimeoutMs is the number of milliseconds to timeout HTTP requests + // LocalIdleTimeoutMs is the number of milliseconds to timeout HTTP streams // to the local app instance. If not set, no value is set, Envoy defaults are - // respected (15s) + // respected (300s) LocalIdleTimeoutMs *int `mapstructure:"local_idle_timeout_ms"` // Protocol describes the service's protocol. Valid values are "tcp", diff --git a/website/content/docs/connect/proxies/envoy.mdx b/website/content/docs/connect/proxies/envoy.mdx index 526d642bc8a7..479ec46df448 100644 --- a/website/content/docs/connect/proxies/envoy.mdx +++ b/website/content/docs/connect/proxies/envoy.mdx @@ -253,6 +253,11 @@ defaults that are inherited by all services. specified, inherits the Envoy default for route timeouts (15s). A value of 0 will disable request timeouts. +- `local_idle_timeout_ms` - In milliseconds, the stream timeout for HTTP requests + to the local application instance. Applies to HTTP based protocols only. If not + specified, inherits the Envoy default for route idle timeouts (300s). A value of 0 will + disable request timeouts. + ### Proxy Upstream Config Options The following configuration items may be overridden directly in the From 8592e233a074ea46bb747fbc0c980048a45ac408 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 01:15:05 -0400 Subject: [PATCH 05/13] add changelog entry --- .changelog/14340.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changelog/14340.txt diff --git a/.changelog/14340.txt b/.changelog/14340.txt new file mode 100644 index 000000000000..f871e5542871 --- /dev/null +++ b/.changelog/14340.txt @@ -0,0 +1,4 @@ +```release-note:feature +connect: Add local_idle_timeout_ms to allow configuring the Envoy route idle timeout on local_app +connect: Add IdleTimeout to service-router to allow configuring the Envoy route idle timeout +``` From af6a0120c414c743785258dfe58bdbf24e11879f Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 01:46:15 -0400 Subject: [PATCH 06/13] correct IdleTimeout struct field comment --- agent/structs/config_entry_discoverychain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/structs/config_entry_discoverychain.go b/agent/structs/config_entry_discoverychain.go index 858106b397bf..a00c31af5f5b 100644 --- a/agent/structs/config_entry_discoverychain.go +++ b/agent/structs/config_entry_discoverychain.go @@ -400,8 +400,8 @@ type ServiceRouteDestination struct { // downstream request (and retries) to be processed. RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` - // IdleTimeout is the total amount of time permitted for the entire - // downstream request (and retries) to be processed. + // IdleTimeout is The total amount of time permitted for the request stream + // to be idle IdleTimeout time.Duration `json:",omitempty" alias:"idle_timeout"` // NumRetries is the number of times to retry the request when a retryable From 7fb0fb95db9dffd0798166bec32a71b792ad1d86 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 01:50:32 -0400 Subject: [PATCH 07/13] fix formatting --- agent/xds/config_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/xds/config_test.go b/agent/xds/config_test.go index 4cda0255693b..12fec68d6758 100644 --- a/agent/xds/config_test.go +++ b/agent/xds/config_test.go @@ -189,7 +189,8 @@ func TestParseProxyConfig(t *testing.T) { LocalIdleTimeoutMs: intPointer(1000), Protocol: "tcp", }, - }} + }, + } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ParseProxyConfig(tt.input) From 9e4d33b4533015771c12d94b11b2fd9f037d5755 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 01:54:08 -0400 Subject: [PATCH 08/13] remove EOF newlines --- .../routes/connect-proxy-with-chain-and-router.latest.golden | 2 +- .../ingress-with-chain-and-router-header-manip.latest.golden | 2 +- .../testdata/routes/ingress-with-chain-and-router.latest.golden | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden index 4c8b9635859a..996db435555c 100644 --- a/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/connect-proxy-with-chain-and-router.latest.golden @@ -414,4 +414,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} +} \ No newline at end of file diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden index 2a4d47de64b3..14727c11d8fa 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router-header-manip.latest.golden @@ -453,4 +453,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} +} \ No newline at end of file diff --git a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden index ece3692b3771..783e87169c26 100644 --- a/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden +++ b/agent/xds/testdata/routes/ingress-with-chain-and-router.latest.golden @@ -415,4 +415,4 @@ ], "typeUrl": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration", "nonce": "00000001" -} +} \ No newline at end of file From ff4a3ea153741d89d969a7580cc7538e8c1a843f Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 25 Aug 2022 17:50:03 -0400 Subject: [PATCH 09/13] Update website/content/docs/connect/proxies/envoy.mdx Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> --- website/content/docs/connect/proxies/envoy.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/content/docs/connect/proxies/envoy.mdx b/website/content/docs/connect/proxies/envoy.mdx index 9bad64aac235..e28fd708a413 100644 --- a/website/content/docs/connect/proxies/envoy.mdx +++ b/website/content/docs/connect/proxies/envoy.mdx @@ -255,8 +255,8 @@ defaults that are inherited by all services. - `local_idle_timeout_ms` - In milliseconds, the stream timeout for HTTP requests to the local application instance. Applies to HTTP based protocols only. If not - specified, inherits the Envoy default for route idle timeouts (300s). A value of 0 will - disable request timeouts. + specified, inherits the Envoy default for route idle timeouts (300s). A value of 0 + disables request timeouts. ### Proxy Upstream Config Options From c63dd09113449ec7c35d60034f36beaf5dae99ba Mon Sep 17 00:00:00 2001 From: James Oulman Date: Tue, 1 Nov 2022 23:03:17 -0400 Subject: [PATCH 10/13] go fmt --- agent/xds/config_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/xds/config_test.go b/agent/xds/config_test.go index 44e00f11f821..89bd7a6c0a85 100644 --- a/agent/xds/config_test.go +++ b/agent/xds/config_test.go @@ -188,9 +188,9 @@ func TestParseProxyConfig(t *testing.T) { LocalConnectTimeoutMs: 5000, LocalIdleTimeoutMs: intPointer(1000), Protocol: "tcp", - }, - }, - { + }, + }, + { name: "balance inbound connections override, string", input: map[string]interface{}{ "balance_inbound_connections": "exact_balance", From 20836ac72578a2fad04060a4053cd5ace5ee5a6d Mon Sep 17 00:00:00 2001 From: James Oulman Date: Mon, 28 Nov 2022 17:44:43 -0500 Subject: [PATCH 11/13] remove trailing newline. Co-authored-by: Dhia Ayachi --- website/content/docs/connect/proxies/envoy.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/website/content/docs/connect/proxies/envoy.mdx b/website/content/docs/connect/proxies/envoy.mdx index 05187a641511..b33cd2737a9a 100644 --- a/website/content/docs/connect/proxies/envoy.mdx +++ b/website/content/docs/connect/proxies/envoy.mdx @@ -344,7 +344,6 @@ defaults that are inherited by all services. - `exact_balance` - Inbound connections to the service use the [Envoy Exact Balance Strategy.](https://cloudnative.to/envoy/api-v3/config/listener/v3/listener.proto.html#config-listener-v3-listener-connectionbalanceconfig-exactbalance) - ### Proxy Upstream Config Options The following configuration items may be overridden directly in the From 7d40e16a594ae7982d653363537b598c65e64fa9 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Mon, 28 Nov 2022 17:45:26 -0500 Subject: [PATCH 12/13] Update local_idle_timeout_ms based on PR suggestion. Co-authored-by: Dhia Ayachi --- website/content/docs/connect/proxies/envoy.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/content/docs/connect/proxies/envoy.mdx b/website/content/docs/connect/proxies/envoy.mdx index b33cd2737a9a..0313223102fc 100644 --- a/website/content/docs/connect/proxies/envoy.mdx +++ b/website/content/docs/connect/proxies/envoy.mdx @@ -331,9 +331,9 @@ defaults that are inherited by all services. specified, inherits the Envoy default for route timeouts (15s). A value of 0 will disable request timeouts. -- `local_idle_timeout_ms` - In milliseconds, the stream timeout for HTTP requests +- `local_idle_timeout_ms` - In milliseconds, the idle timeout for HTTP requests to the local application instance. Applies to HTTP based protocols only. If not - specified, inherits the Envoy default for route idle timeouts (300s). A value of 0 + specified, inherits the Envoy default for route idle timeouts (15s). A value of 0 disables request timeouts. - `balance_inbound_connections` - The strategy used for balancing inbound connections From e078ad21c4ed8057f3887193be385b474f676cfa Mon Sep 17 00:00:00 2001 From: James Oulman Date: Tue, 29 Nov 2022 10:39:43 -0500 Subject: [PATCH 13/13] add missing test for idle_timeout xds generation --- agent/xds/listeners_test.go | 1 + .../listeners/http-listener-with-timeouts.latest.golden | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/agent/xds/listeners_test.go b/agent/xds/listeners_test.go index 5cff623bb3bc..309dfaab5d8f 100644 --- a/agent/xds/listeners_test.go +++ b/agent/xds/listeners_test.go @@ -230,6 +230,7 @@ func TestListenersFromSnapshot(t *testing.T) { ns.Proxy.Config["protocol"] = "http" ns.Proxy.Config["local_connect_timeout_ms"] = 1234 ns.Proxy.Config["local_request_timeout_ms"] = 2345 + ns.Proxy.Config["local_idle_timeout_ms"] = 3456 }, nil) }, }, diff --git a/agent/xds/testdata/listeners/http-listener-with-timeouts.latest.golden b/agent/xds/testdata/listeners/http-listener-with-timeouts.latest.golden index a70876af29d1..a3c58e2ab848 100644 --- a/agent/xds/testdata/listeners/http-listener-with-timeouts.latest.golden +++ b/agent/xds/testdata/listeners/http-listener-with-timeouts.latest.golden @@ -83,7 +83,8 @@ }, "route": { "cluster": "local_app", - "timeout": "2.345s" + "timeout": "2.345s", + "idleTimeout": "3.456s" } } ]