Repository: kumahq/kuma
Pull request #1279 (2020-12-03 20:18:56)

chore(*) disable timeout on route level (bp #1275)
This is an automated backport of pull request #1275 done by Mergify
---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the [documentation](https://docs.mergify.io/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.io/) you can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/
</details>



Patch:
diff --git a/pkg/xds/envoy/routes/default_route_configurer.go b/pkg/xds/envoy/routes/default_route_configurer.go
index b077caf1c..017d129fe 100644
--- a/pkg/xds/envoy/routes/default_route_configurer.go
+++ b/pkg/xds/envoy/routes/default_route_configurer.go
@@ -1,6 +1,7 @@
 package routes
 
 import (
+	"github.com/golang/protobuf/ptypes/duration"
 	"github.com/golang/protobuf/ptypes/wrappers"
 
 	envoy_route "github.com/envoyproxy/go-control-plane/envoy/api/v2/route"
@@ -43,7 +44,11 @@ type RouteConfigurer struct {
 }
 
 func (c RouteConfigurer) routeAction() *envoy_route.RouteAction {
-	routeAction := envoy_route.RouteAction{}
+	routeAction := envoy_route.RouteAction{
+		// This disable the timeout of the response. As Envoy docs suggest
+		// disabling this solves problems with long lived and streaming requests.
+		Timeout: &duration.Duration{Seconds: 0, Nanos: 0},
+	}
 	if len(c.subsets) == 1 {
 		routeAction.ClusterSpecifier = &envoy_route.RouteAction_Cluster{
 			Cluster: c.subsets[0].ClusterName,


Test patch:
diff --git a/pkg/xds/envoy/listeners/http_inbound_route_configurer_test.go b/pkg/xds/envoy/listeners/http_inbound_route_configurer_test.go
index 86827688f..d650a0179 100644
--- a/pkg/xds/envoy/listeners/http_inbound_route_configurer_test.go
+++ b/pkg/xds/envoy/listeners/http_inbound_route_configurer_test.go
@@ -76,6 +76,7 @@ var _ = Describe("HttpInboundRouteConfigurer", func() {
                           prefix: /
                         route:
                           cluster: localhost:8080
+                          timeout: 0s
                   statPrefix: localhost_8080
 `,
 		}),
diff --git a/pkg/xds/envoy/listeners/http_outbound_route_configurer_test.go b/pkg/xds/envoy/listeners/http_outbound_route_configurer_test.go
index fb9934350..82bc6decc 100644
--- a/pkg/xds/envoy/listeners/http_outbound_route_configurer_test.go
+++ b/pkg/xds/envoy/listeners/http_outbound_route_configurer_test.go
@@ -112,6 +112,7 @@ var _ = Describe("HttpOutboundRouteConfigurer", func() {
                               name: backend
                               weight: 80
                             totalWeight: 100
+                          timeout: 0s
                   statPrefix: "127_0_0_1_18080"
             name: outbound:127.0.0.1:18080
             trafficDirection: OUTBOUND`,
diff --git a/pkg/xds/envoy/routes/default_route_configurer_test.go b/pkg/xds/envoy/routes/default_route_configurer_test.go
index 092de78e5..2224bfef8 100644
--- a/pkg/xds/envoy/routes/default_route_configurer_test.go
+++ b/pkg/xds/envoy/routes/default_route_configurer_test.go
@@ -44,6 +44,7 @@ var _ = Describe("DefaultRouteConfigurer", func() {
                 prefix: /
               route:
                 cluster: backend
+                timeout: 0s
 `,
 		}),
 		Entry("basic VirtualHost with weighted destination clusters", testCase{
@@ -71,6 +72,7 @@ var _ = Describe("DefaultRouteConfigurer", func() {
                     name: backend
                     weight: 70
                   totalWeight: 100
+                timeout: 0s
 `,
 		}),
 		Entry("basic VirtualHost with weighted destination clusters with totalWeight less than 100", testCase{
@@ -98,6 +100,7 @@ var _ = Describe("DefaultRouteConfigurer", func() {
                     name: backend
                     weight: 60
                   totalWeight: 90
+                timeout: 0s
 `,
 		}),
 	)
diff --git a/pkg/xds/generator/testdata/inbound-proxy/3-envoy-config.golden.yaml b/pkg/xds/generator/testdata/inbound-proxy/3-envoy-config.golden.yaml
index b23daec07..d2bb5932e 100644
--- a/pkg/xds/generator/testdata/inbound-proxy/3-envoy-config.golden.yaml
+++ b/pkg/xds/generator/testdata/inbound-proxy/3-envoy-config.golden.yaml
@@ -141,6 +141,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls
@@ -270,6 +271,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls
diff --git a/pkg/xds/generator/testdata/inbound-proxy/4-envoy-config.golden.yaml b/pkg/xds/generator/testdata/inbound-proxy/4-envoy-config.golden.yaml
index ab1d492f5..0013801fa 100644
--- a/pkg/xds/generator/testdata/inbound-proxy/4-envoy-config.golden.yaml
+++ b/pkg/xds/generator/testdata/inbound-proxy/4-envoy-config.golden.yaml
@@ -145,6 +145,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls
@@ -278,6 +279,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls
diff --git a/pkg/xds/generator/testdata/outbound-proxy/03.envoy.golden.yaml b/pkg/xds/generator/testdata/outbound-proxy/03.envoy.golden.yaml
index 7affb20a1..6c76b3b44 100644
--- a/pkg/xds/generator/testdata/outbound-proxy/03.envoy.golden.yaml
+++ b/pkg/xds/generator/testdata/outbound-proxy/03.envoy.golden.yaml
@@ -269,6 +269,7 @@ resources:
                             prefix: /
                           route:
                             cluster: api-http
+                            timeout: 0s
                 statPrefix: api-http
       name: outbound:127.0.0.1:40001
       trafficDirection: OUTBOUND
@@ -329,6 +330,7 @@ resources:
                             prefix: /
                           route:
                             cluster: api-http2
+                            timeout: 0s
                 statPrefix: api-http2
       name: outbound:127.0.0.1:40003
       trafficDirection: OUTBOUND
@@ -367,6 +369,7 @@ resources:
                             prefix: /
                           route:
                             cluster: api-grpc
+                            timeout: 0s
                 statPrefix: api-grpc
       name: outbound:127.0.0.1:40004
       trafficDirection: OUTBOUND
diff --git a/pkg/xds/generator/testdata/outbound-proxy/04.envoy.golden.yaml b/pkg/xds/generator/testdata/outbound-proxy/04.envoy.golden.yaml
index e65cae484..e017342a2 100644
--- a/pkg/xds/generator/testdata/outbound-proxy/04.envoy.golden.yaml
+++ b/pkg/xds/generator/testdata/outbound-proxy/04.envoy.golden.yaml
@@ -404,6 +404,7 @@ resources:
                             prefix: /
                           route:
                             cluster: api-http
+                            timeout: 0s
                 statPrefix: api-http
       name: outbound:127.0.0.1:40001
       trafficDirection: OUTBOUND
diff --git a/pkg/xds/generator/testdata/outbound-proxy/05.envoy.golden.yaml b/pkg/xds/generator/testdata/outbound-proxy/05.envoy.golden.yaml
index 8604adc21..3d4f67c37 100644
--- a/pkg/xds/generator/testdata/outbound-proxy/05.envoy.golden.yaml
+++ b/pkg/xds/generator/testdata/outbound-proxy/05.envoy.golden.yaml
@@ -63,6 +63,7 @@ resources:
                               filterMetadata:
                                 envoy.lb:
                                   kuma.io/protocol: http
+                            timeout: 0s
                 statPrefix: es
       name: outbound:127.0.0.1:18081
       trafficDirection: OUTBOUND
diff --git a/pkg/xds/generator/testdata/outbound-proxy/06.envoy.golden.yaml b/pkg/xds/generator/testdata/outbound-proxy/06.envoy.golden.yaml
index 581e7b40a..83c673d52 100644
--- a/pkg/xds/generator/testdata/outbound-proxy/06.envoy.golden.yaml
+++ b/pkg/xds/generator/testdata/outbound-proxy/06.envoy.golden.yaml
@@ -64,6 +64,7 @@ resources:
                               filterMetadata:
                                 envoy.lb:
                                   kuma.io/protocol: http2
+                            timeout: 0s
                 statPrefix: es2
       name: outbound:127.0.0.1:18082
       trafficDirection: OUTBOUND
diff --git a/pkg/xds/generator/testdata/profile-source/3-envoy-config.golden.yaml b/pkg/xds/generator/testdata/profile-source/3-envoy-config.golden.yaml
index 15c389018..67217c581 100644
--- a/pkg/xds/generator/testdata/profile-source/3-envoy-config.golden.yaml
+++ b/pkg/xds/generator/testdata/profile-source/3-envoy-config.golden.yaml
@@ -192,6 +192,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls
diff --git a/pkg/xds/generator/testdata/profile-source/4-envoy-config.golden.yaml b/pkg/xds/generator/testdata/profile-source/4-envoy-config.golden.yaml
index 397b1b1c2..89cb53ca1 100644
--- a/pkg/xds/generator/testdata/profile-source/4-envoy-config.golden.yaml
+++ b/pkg/xds/generator/testdata/profile-source/4-envoy-config.golden.yaml
@@ -214,6 +214,7 @@ resources:
                             prefix: /
                           route:
                             cluster: localhost:8080
+                            timeout: 0s
                 statPrefix: localhost_8080
           transportSocket:
             name: envoy.transport_sockets.tls