Skip to content

Commit 31a0bd4

Browse files
authored
Merge pull request #2268 from O-sura/apip-resiliency
Adding end-to-end Timeout Functionality
2 parents e5ae371 + 86b7218 commit 31a0bd4

51 files changed

Lines changed: 3780 additions & 570 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gateway/build-manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ policies:
6161
version: v1.0.2
6262
gomodule: github.com/wso2/gateway-controllers/policies/mcp-acl-list@v1
6363
- name: mcp-auth
64-
version: v1.0.3
64+
version: v1.1.0
6565
gomodule: github.com/wso2/gateway-controllers/policies/mcp-auth@v1
6666
- name: mcp-authz
6767
version: v1.0.1

gateway/configs/config-template.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ connect_timeout_ms = 5000
212212
server_header_transformation = "OVERWRITE"
213213
server_header_value = "WSO2 API Platform"
214214

215+
# HTTP Connection Manager (downstream) timeouts
216+
# A value of zero disables any of these timeout settings.
217+
[router.http_listener.timeouts]
218+
# Max duration for the entire downstream request
219+
request_timeout = "0s"
220+
# Max duration to receive the complete request headers
221+
request_headers_timeout = "0s"
222+
# Idle timeout for a single HTTP stream/request
223+
stream_idle_timeout = "5m"
224+
# Idle timeout for the downstream connection
225+
idle_timeout = "1h"
226+
215227
[router.policy_engine]
216228
host = "policy-engine"
217229
port = 9001

gateway/gateway-controller/api/management-openapi.yaml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4194,6 +4194,8 @@ components:
41944194
description: List of API-level policies applied to all operations unless overridden
41954195
items:
41964196
$ref: "#/components/schemas/Policy"
4197+
resilience:
4198+
$ref: "#/components/schemas/Resilience"
41974199
operations:
41984200
type: array
41994201
description: List of HTTP operations/routes
@@ -4223,7 +4225,8 @@ components:
42234225
example: my-upstream-1
42244226
basePath:
42254227
type: string
4226-
description: Base path prefix for all endpoints in this upstream (e.g., /api/v2). All requests to this upstream will have this path prepended.
4228+
description: Base path prefix for all endpoints in this upstream (e.g., /api/v2). All requests to this upstream will have this path prepended. Must start with '/' and must not end with '/'; omit for root.
4229+
pattern: '^/[a-zA-Z0-9\-._~!$&''()*+,;=:@%/]*[^/]$'
42274230
example: /api/v2
42284231
timeout:
42294232
$ref: "#/components/schemas/UpstreamTimeout"
@@ -4243,7 +4246,7 @@ components:
42434246
example: http://prod-backend-1:5000
42444247
weight:
42454248
type: integer
4246-
description: Weight for load balancing (optional, default 100)
4249+
description: Relative weight for load balancing across multiple upstream targets. Reserved for future multi-target load balancing; not applied yet (only the first target is currently used).
42474250
minimum: 0
42484251
maximum: 100
42494252
example: 80
@@ -4258,6 +4261,25 @@ components:
42584261
pattern: '^\d+(\.\d+)?(ms|s|m|h)$'
42594262
example: 5s
42604263

4264+
Resilience:
4265+
type: object
4266+
description: >
4267+
Backend/route timeout configuration. Maps to Envoy RouteAction timeouts.
4268+
Can be set at the API level (applies to all routes) and/or the operation level
4269+
(applies to that operation's route). When set at both levels, the operation-level
4270+
value takes precedence. When unset, the gateway's global route timeout defaults apply.
4271+
properties:
4272+
timeout:
4273+
type: string
4274+
description: Maximum time for the entire route (request to upstream response). "0s" disables the timeout.
4275+
pattern: '^\d+(\.\d+)?(ms|s|m|h)$'
4276+
example: 15s
4277+
idleTimeout:
4278+
type: string
4279+
description: Per-route stream idle timeout (overrides the listener stream idle timeout for this route). "0s" disables the timeout.
4280+
pattern: '^\d+(\.\d+)?(ms|s|m|h)$'
4281+
example: 0s
4282+
42614283
Upstream:
42624284
type: object
42634285
oneOf:
@@ -4313,6 +4335,8 @@ components:
43134335
description: List of policies applied only to this operation (overrides or adds to API-level policies)
43144336
items:
43154337
$ref: "#/components/schemas/Policy"
4338+
resilience:
4339+
$ref: "#/components/schemas/Resilience"
43164340

43174341
Policy:
43184342
type: object
@@ -5322,6 +5346,11 @@ components:
53225346
minLength: 1
53235347
maxLength: 253
53245348
example: "mcp1.example.com"
5349+
upstreamDefinitions:
5350+
type: array
5351+
description: List of reusable upstream definitions with optional timeout configurations. Referenced by upstream.ref.
5352+
items:
5353+
$ref: "#/components/schemas/UpstreamDefinition"
53255354
upstream:
53265355
description: The backend MCP server url and auth configurations
53275356
allOf:
@@ -5350,6 +5379,15 @@ components:
53505379
enum: [deployed, undeployed]
53515380
default: deployed
53525381
example: deployed
5382+
resilience:
5383+
$ref: '#/components/schemas/Resilience'
5384+
description: >
5385+
API-level backend/route timeout configuration. Applies to the traffic-forwarding
5386+
routes generated for this MCP proxy (GET/POST/DELETE on the MCP resource path).
5387+
Supported at the API level only. Because MCP transports are long-lived streams,
5388+
the route timeout defaults to disabled ("0s") for MCP unless a timeout is set here
5389+
(unlike REST/LLM, which fall back to the gateway's global route timeout); the idle
5390+
timeout remains the liveness guard.
53535391
53545392
MCPTool:
53555393
type: object
@@ -5790,6 +5828,11 @@ components:
57905828
type: string
57915829
description: Template name to use for this LLM Provider
57925830
example: openai
5831+
upstreamDefinitions:
5832+
type: array
5833+
description: List of reusable upstream definitions with optional timeout configurations. Referenced by upstream.ref.
5834+
items:
5835+
$ref: "#/components/schemas/UpstreamDefinition"
57935836
upstream:
57945837
allOf:
57955838
- $ref: "#/components/schemas/Upstream"
@@ -5818,6 +5861,13 @@ components:
58185861
enum: [deployed, undeployed]
58195862
default: deployed
58205863
example: deployed
5864+
resilience:
5865+
$ref: '#/components/schemas/Resilience'
5866+
description: >
5867+
API-level backend/route timeout configuration. Applies to all routes generated
5868+
for this LLM Provider (the routes that forward traffic upstream). Supported at the
5869+
API level only - LLM routes are synthesized by the gateway, so there is no
5870+
operation-level override.
58215871
58225872
UpstreamAuth:
58235873
type: object
@@ -6108,6 +6158,13 @@ components:
61086158
enum: [deployed, undeployed]
61096159
default: deployed
61106160
example: deployed
6161+
resilience:
6162+
$ref: '#/components/schemas/Resilience'
6163+
description: >
6164+
API-level backend/route timeout configuration. Applies to all routes generated
6165+
for this LLM Proxy (the routes that forward traffic upstream). Supported at the
6166+
API level only - LLM routes are synthesized by the gateway, so there is no
6167+
operation-level override.
61116168
61126169
SecretConfigurationRequest:
61136170
type: object

0 commit comments

Comments
 (0)