Skip to content

Commit

Permalink
docs: highlight default 15s request timeout (#3529)
Browse files Browse the repository at this point in the history
Signed-off-by: Arko Dasgupta <[email protected]>
Co-authored-by: zirain <[email protected]>
  • Loading branch information
arkodg and zirain authored Jun 4, 2024
1 parent af79e1c commit ddd6e40
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 2 deletions.
4 changes: 3 additions & 1 deletion site/content/en/latest/tasks/traffic/http-timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
title: "HTTP Timeouts"
---

The [HTTPRouteTimeouts][] resource allows users to configure request timeouts and response timeouts for an [HTTPRouteRule][]. This task shows how to configure timeouts.
The default request timeout is set to 15 seconds in Envoy Proxy.
The [HTTPRouteTimeouts][] resource allows users to configure request timeouts for an [HTTPRouteRule][].
This task shows you how to configure timeouts.

The [HTTPRouteTimeouts][] supports two kinds of timeouts:
- **request**: Request specifies the maximum duration for a gateway to respond to an HTTP request.
Expand Down
80 changes: 79 additions & 1 deletion site/content/en/v1.0.1/tasks/traffic/http-timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
title: "HTTP Timeouts"
---

The [HTTPRouteTimeouts][] resource allows users to configure request timeouts and response timeouts for an [HTTPRouteRule][]. This guide shows how to configure timeouts.
The default request timeout is set to 15 seconds in Envoy Proxy.
The [HTTPRouteTimeouts][] resource allows users to configure request timeouts for an [HTTPRouteRule][].
This task shows you how to configure timeouts.

The [HTTPRouteTimeouts][] supports two kinds of timeouts:
- **request**: Request specifies the maximum duration for a gateway to respond to an HTTP request.
Expand All @@ -22,6 +24,9 @@ backend has the ability to delay responses; we use it as the backend to control
### request timeout
We configure the backend to delay responses by 3 seconds, then we set the request timeout to 4 seconds. Envoy Gateway will successfully respond to the request.

{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}

```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.networking.k8s.io/v1
Expand Down Expand Up @@ -51,6 +56,41 @@ spec:
EOF
```

{{% /tab %}}
{{% tab header="Apply from file" %}}
Save and apply the following resource to your cluster:

```yaml
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: backend
spec:
hostnames:
- timeout.example.com
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: eg
rules:
- backendRefs:
- group: ""
kind: Service
name: backend
port: 3000
weight: 1
matches:
- path:
type: PathPrefix
value: /
timeouts:
request: "4s"
```
{{% /tab %}}
{{< /tabpane >}}
```shell
curl --header "Host: timeout.example.com" http://${GATEWAY_HOST}/?delay=3s -I
```
Expand All @@ -65,6 +105,9 @@ content-length: 480
Then we set the request timeout to 2 seconds. In this case, Envoy Gateway will respond with a timeout.
{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.networking.k8s.io/v1
Expand Down Expand Up @@ -94,6 +137,41 @@ spec:
EOF
```

{{% /tab %}}
{{% tab header="Apply from file" %}}
Save and apply the following resource to your cluster:

```yaml
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: backend
spec:
hostnames:
- timeout.example.com
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: eg
rules:
- backendRefs:
- group: ""
kind: Service
name: backend
port: 3000
weight: 1
matches:
- path:
type: PathPrefix
value: /
timeouts:
request: "2s"
```
{{% /tab %}}
{{< /tabpane >}}
```shell
curl --header "Host: timeout.example.com" http://${GATEWAY_HOST}/?delay=3s -v
```
Expand Down

0 comments on commit ddd6e40

Please sign in to comment.