You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site-src/api-types/httproute.md
+41-2Lines changed: 41 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ The specification of an HTTPRoute consists of:
17
17
matching the Host header of HTTP requests.
18
18
-[Rules][httprouterule]- Define a list of rules to perform actions against
19
19
matching HTTP requests. Each rule consists of [matches][matches],
20
-
[filters][filters] (optional), and [backendRefs][backendRef] (optional)
20
+
[filters][filters] (optional), [backendRefs][backendRef] (optional) and [timeouts][timeouts] (optional)
21
21
fields.
22
22
23
23
The following illustrates an HTTPRoute that sends all traffic to one Service:
@@ -165,6 +165,44 @@ Service:
165
165
Reference the [backendRef][backendRef] API documentation for additional details
166
166
on `weight` and other fields.
167
167
168
+
#### Timeouts (optional)
169
+
170
+
??? example "Experimental Channel in v1.0.0+"
171
+
172
+
HTTPRoute timeouts are part of the Experimental Channel in `v1.0.0+`.
173
+
174
+
HTTPRoute Rules include a `Timeouts` field. If unspecified, timeout behavior is implementation-specific.
175
+
176
+
There are 2 kinds of timeouts that can be configured in an HTTPRoute Rule:
177
+
178
+
1.`request` is the timeout for the Gateway API implementation to send a response to a client HTTP request. This timeout is intended to cover as close to the whole request-response transaction as possible, although an implementation MAY choose to start the timeout after the entire request stream has been received instead of immediately after the transaction is initiated by the client.
179
+
180
+
2.`backendRequest` is a timeout for a single request from the Gateway to a backend. This timeout covers the time from when the request first starts being sent from the gateway to when the full response has been received from the backend. This can be particularly helpful if the Gateway retries connections to a backend.
181
+
182
+
Because the `request` timeout encompasses the `backendRequest` timeout, the value of `backendRequest` must not be greater than the value of `request` timeout.
183
+
184
+
Timeouts are optional, and their fields are of type [Duration](/geps/gep-2257/). A zero-valued timeout ("0s") MUST be interpreted as disabling the timeout. A valid non-zero-valued timeout MUST be >= 1ms.
185
+
186
+
The following example uses the `request` field which will cause a timeout if a client request is taking longer than 10 seconds to complete. The example also defines a 2s `backendRequest` which specifies a timeout for an individual request from the gateway to a backend service `timeout-svc`:
187
+
```yaml
188
+
{% include 'experimental/http-route-timeouts/timeout-example.yaml' %}
189
+
```
190
+
191
+
Reference the [timeouts][timeouts] API documentation for additional details.
192
+
193
+
##### Backend Protocol
194
+
195
+
??? example "Experimental Channel in v1.0.0+"
196
+
197
+
This concept is part of the Experimental Channel in `v1.0.0+`.
198
+
199
+
200
+
Some implementations may require the [backendRef][backendRef] to be labeled
201
+
explicitly in order to route traffic using a certain protocol. For Kubernetes
202
+
Service backends this can be done by specifying the [`appProtocol`][appProtocol]
203
+
field.
204
+
205
+
168
206
## Status
169
207
170
208
Status defines the observed state of HTTPRoute.
@@ -214,4 +252,5 @@ resolution applies to merging, refer to the [API specification][httprouterule].
This concept is part of the Experimental Channel in `v1.0.0+`.
6
+
7
+
Not all implementations of Gateway API support automatic protocol selection. In some cases protocols are disabled without an explicit opt-in.
8
+
9
+
When a Route's backend references a Kubernetes Service, application developers can specify the protocol using `ServicePort`[`appProtocol`][appProtocol] field.
10
+
11
+
For example the following `store` Kubernetes Service is indicating the port `8080` supports HTTP/2 Prior Knowledge.
12
+
13
+
14
+
```yaml
15
+
apiVersion: v1
16
+
kind: Service
17
+
metadata:
18
+
name: store
19
+
spec:
20
+
selector:
21
+
app: store
22
+
ports:
23
+
- protocol: TCP
24
+
appProtocol: kubernetes.io/h2c
25
+
port: 8080
26
+
targetPort: 8080
27
+
```
28
+
29
+
Currently, Gateway API has conformance testing for:
0 commit comments