Skip to content

Commit ce1f531

Browse files
committed
Updating GEP-1742 to clarify timeout formatting
1 parent 5889896 commit ce1f531

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

geps/gep-1742.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ sequenceDiagram
206206
participant C as Client
207207
participant P as Proxy
208208
participant U as Upstream
209-
209+
210210
C->>P: Connection Started
211211
activate U
212212
activate C
@@ -224,7 +224,7 @@ sequenceDiagram
224224
activate U
225225
note left of U: timeout queue<br/>(wait for available server)
226226
deactivate U
227-
227+
228228
P->>U: Connection Started
229229
activate U
230230
P->>U: Starts sending Request
@@ -370,7 +370,7 @@ sequenceDiagram
370370

371371
Both timeout fields are string duration values as specified by
372372
[Golang time.ParseDuration](https://pkg.go.dev/time#ParseDuration) and MUST be >= 1ms
373-
or 0 to disable (no timeout).
373+
and <= 100y.
374374

375375
### GO
376376

@@ -388,8 +388,6 @@ type HTTPRouteRule struct {
388388
}
389389

390390
// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute.
391-
// Timeout values are formatted like 1h/1m/1s/1ms as parsed by Golang time.ParseDuration
392-
// and MUST BE >= 1ms or 0 to disable (no timeout).
393391
type HTTPRouteTimeouts struct {
394392
// Request specifies the duration for processing an HTTP client request after which the
395393
// gateway will time out if unable to send a response.
@@ -403,13 +401,22 @@ type HTTPRouteTimeouts struct {
403401
// request stream has been received instead of immediately after the transaction is
404402
// initiated by the client.
405403
//
404+
// This value follows a subset of Golang and XML Duration formatting, for example 1m, 1s,
405+
// or 1ms. This value MUST BE >= 0 and <= 9999h. When "0" is specified, it indicates that
406+
// no timeout should be implemented. If an implementation cannot support the granularity
407+
// specified, it MUST round up to the closest value it supports. For example, if 1ms is
408+
// specified, and an implementation can only configure timeouts in seconds, it MUST configure
409+
// 1 second as the timeout. In the special case of a "0" timeout, the implementation SHOULD
410+
// NOT implement a timeout. If that is not possible it MUST configure the maximum timeout
411+
// value it supports.
412+
//
406413
// When this field is unspecified, request timeout behavior is implementation-dependent.
407414
//
408415
// Support: Extended
409416
//
410417
// +optional
411-
// +kubebuilder:validation:Format=duration
412-
Request *metav1.Duration `json:"request,omitempty"`
418+
// +kubebuilder:validation:Pattern=^(0|[1-9][0-9]{0,3}(m|s|ms))$
419+
Request *metav1.Duration `json:"request,omitempty"`
413420

414421
// BackendRequest specifies a timeout for an individual request from the gateway
415422
// to a backend service. This covers the time from when the request first starts being
@@ -419,14 +426,22 @@ type HTTPRouteTimeouts struct {
419426
// may result in more than one call from the gateway to the destination backend service,
420427
// for example, if automatic retries are supported.
421428
//
422-
// Because the Request timeout encompasses the BackendRequest timeout,
423-
// the value of BackendRequest defaults to and must be <= the value of Request timeout.
429+
// This value follows a subset of Golang and XML Duration formatting, for example 1m, 1s,
430+
// or 1ms. This value MUST BE >= 0 and <= 9999h. When "0" is specified, it indicates that
431+
// no timeout should be implemented. If an implementation cannot support the granularity
432+
// specified, it MUST round up to the closest value it supports. For example, if 1ms is
433+
// specified, and an implementation can only configure timeouts in seconds, it MUST configure
434+
// 1 second as the timeout. In the special case of a "0" timeout, the implementation SHOULD
435+
// NOT implement a timeout. If that is not possible it MUST configure the maximum timeout
436+
// value it supports.
437+
//
438+
// When this field is unspecified, request timeout behavior is implementation-dependent.
424439
//
425440
// Support: Extended
426441
//
427442
// +optional
428-
// +kubebuilder:validation:Format=duration
429-
BackendRequest *metav1.Duration `json:"backendRequest,omitempty"`
443+
// +kubebuilder:validation:Pattern=^(0|[1-9][0-9]{0,3}(m|s|ms))$
444+
BackendRequest *string `json:"backendRequest,omitempty"`
430445
}
431446
```
432447

0 commit comments

Comments
 (0)