From ce1f531a1920e292d1302cfd6a8b11e780ed63db Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Wed, 28 Jun 2023 17:12:16 +0000 Subject: [PATCH] Updating GEP-1742 to clarify timeout formatting --- geps/gep-1742.md | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/geps/gep-1742.md b/geps/gep-1742.md index c3b7ddb3c2..23b93ceff8 100644 --- a/geps/gep-1742.md +++ b/geps/gep-1742.md @@ -206,7 +206,7 @@ sequenceDiagram participant C as Client participant P as Proxy participant U as Upstream - + C->>P: Connection Started activate U activate C @@ -224,7 +224,7 @@ sequenceDiagram activate U note left of U: timeout queue
(wait for available server) deactivate U - + P->>U: Connection Started activate U P->>U: Starts sending Request @@ -370,7 +370,7 @@ sequenceDiagram Both timeout fields are string duration values as specified by [Golang time.ParseDuration](https://pkg.go.dev/time#ParseDuration) and MUST be >= 1ms -or 0 to disable (no timeout). +and <= 100y. ### GO @@ -388,8 +388,6 @@ type HTTPRouteRule struct { } // HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. -// Timeout values are formatted like 1h/1m/1s/1ms as parsed by Golang time.ParseDuration -// and MUST BE >= 1ms or 0 to disable (no timeout). type HTTPRouteTimeouts struct { // Request specifies the duration for processing an HTTP client request after which the // gateway will time out if unable to send a response. @@ -403,13 +401,22 @@ type HTTPRouteTimeouts struct { // request stream has been received instead of immediately after the transaction is // initiated by the client. // + // This value follows a subset of Golang and XML Duration formatting, for example 1m, 1s, + // or 1ms. This value MUST BE >= 0 and <= 9999h. When "0" is specified, it indicates that + // no timeout should be implemented. If an implementation cannot support the granularity + // specified, it MUST round up to the closest value it supports. For example, if 1ms is + // specified, and an implementation can only configure timeouts in seconds, it MUST configure + // 1 second as the timeout. In the special case of a "0" timeout, the implementation SHOULD + // NOT implement a timeout. If that is not possible it MUST configure the maximum timeout + // value it supports. + // // When this field is unspecified, request timeout behavior is implementation-dependent. // // Support: Extended // // +optional - // +kubebuilder:validation:Format=duration - Request *metav1.Duration `json:"request,omitempty"` + // +kubebuilder:validation:Pattern=^(0|[1-9][0-9]{0,3}(m|s|ms))$ + Request *metav1.Duration `json:"request,omitempty"` // BackendRequest specifies a timeout for an individual request from the gateway // to a backend service. This covers the time from when the request first starts being @@ -419,14 +426,22 @@ type HTTPRouteTimeouts struct { // may result in more than one call from the gateway to the destination backend service, // for example, if automatic retries are supported. // - // Because the Request timeout encompasses the BackendRequest timeout, - // the value of BackendRequest defaults to and must be <= the value of Request timeout. + // This value follows a subset of Golang and XML Duration formatting, for example 1m, 1s, + // or 1ms. This value MUST BE >= 0 and <= 9999h. When "0" is specified, it indicates that + // no timeout should be implemented. If an implementation cannot support the granularity + // specified, it MUST round up to the closest value it supports. For example, if 1ms is + // specified, and an implementation can only configure timeouts in seconds, it MUST configure + // 1 second as the timeout. In the special case of a "0" timeout, the implementation SHOULD + // NOT implement a timeout. If that is not possible it MUST configure the maximum timeout + // value it supports. + // + // When this field is unspecified, request timeout behavior is implementation-dependent. // // Support: Extended // // +optional - // +kubebuilder:validation:Format=duration - BackendRequest *metav1.Duration `json:"backendRequest,omitempty"` + // +kubebuilder:validation:Pattern=^(0|[1-9][0-9]{0,3}(m|s|ms))$ + BackendRequest *string `json:"backendRequest,omitempty"` } ```