Skip to content

Commit

Permalink
chore(*) disable timeout on route level (#1275)
Browse files Browse the repository at this point in the history
* chore(*) disable timeout on route level

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>

* fix(*) test

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
  • Loading branch information
Nikolay Nikolaev authored Dec 3, 2020
1 parent dd77a80 commit 69d9951
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var _ = Describe("HttpInboundRouteConfigurer", func() {
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
`,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
7 changes: 6 additions & 1 deletion pkg/xds/envoy/routes/default_route_configurer.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions pkg/xds/envoy/routes/default_route_configurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var _ = Describe("DefaultRouteConfigurer", func() {
prefix: /
route:
cluster: backend
timeout: 0s
`,
}),
Entry("basic VirtualHost with weighted destination clusters", testCase{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -98,6 +100,7 @@ var _ = Describe("DefaultRouteConfigurer", func() {
name: backend
weight: 60
totalWeight: 90
timeout: 0s
`,
}),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down Expand Up @@ -270,6 +271,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down Expand Up @@ -278,6 +279,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ resources:
prefix: /
route:
cluster: api-http
timeout: 0s
statPrefix: api-http
name: outbound:127.0.0.1:40001
trafficDirection: OUTBOUND
Expand Down Expand Up @@ -329,6 +330,7 @@ resources:
prefix: /
route:
cluster: api-http2
timeout: 0s
statPrefix: api-http2
name: outbound:127.0.0.1:40003
trafficDirection: OUTBOUND
Expand Down Expand Up @@ -367,6 +369,7 @@ resources:
prefix: /
route:
cluster: api-grpc
timeout: 0s
statPrefix: api-grpc
name: outbound:127.0.0.1:40004
trafficDirection: OUTBOUND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ resources:
prefix: /
route:
cluster: api-http
timeout: 0s
statPrefix: api-http
name: outbound:127.0.0.1:40001
trafficDirection: OUTBOUND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ resources:
prefix: /
route:
cluster: localhost:8080
timeout: 0s
statPrefix: localhost_8080
transportSocket:
name: envoy.transport_sockets.tls
Expand Down

0 comments on commit 69d9951

Please sign in to comment.