Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions docs/kubernetes-gateway-api-support-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Consequences that the rest of this document depends on:
| `spec.parametersRef` | **Rejected**: `Accepted=False`, reason `InvalidParameters`. ShenYu has no class-level parameters. |
| `status.conditions[Accepted]` | Written, with `observedGeneration` and stable `lastTransitionTime`. |
| `status.conditions[SupportedVersion]` | Written from the CRD bundle version (see §1). |
| `status.supportedFeatures` | Written as a list of `{name}` entries: `Gateway`, `HTTPRoute`, `ReferenceGrant`, sorted per spec. These are exactly the `GATEWAY-HTTP` profile's core features at v1.5.1 (§6). |
| `status.supportedFeatures` | The three core features plus `HTTPRouteBackendTimeout` and `HTTPRouteRequestTimeout`, sorted by name (§6). |
| Finalizer `gateway-exists-finalizer.gateway.networking.k8s.io` | Held while at least one Gateway references the class; released when the class is deleted or stops being managed by ShenYu. |

### 3.2 Gateway and listeners
Expand Down Expand Up @@ -151,7 +151,7 @@ where they exist, because that is what decides whether a gap can block core conf
| `spec.rules[].filters` | **Not supported at all.** Any filter on a rule removes the route's whole config and sets `Accepted=False`, `UnsupportedValue`. At v1.5.1 a core test requires `RequestHeaderModifier` and another requires `RequestRedirect` (§7.3). |
| `spec.rules[].backendRefs[].filters` | **Silently ignored** (see §5.2). The spec marks this implementation-specific, so ignoring it is permitted — but then it must be documented, which is what this row does. |
| `spec.rules[].retry` | **Silently ignored** (see §5.2). The data plane always uses 3 retries. API level: Extended. |
| `spec.rules[].timeouts` | **Silently ignored** (see §5.2). The data plane always uses a fixed 3000 ms timeout. API level: Extended. |
| `spec.rules[].timeouts` | Extended. `request` bounds proxy execution through downstream completion, including retries and backoff. `backendRequest` bounds each backend call through the full response body. See §7.10. |
| `spec.rules[].sessionPersistence` | **Silently ignored** (see §5.2). Load balancing is always random. API level: Extended. |
| `spec.rules[].name` | Ignored; carries no routing semantics. API level: Extended. |
| `status.parents[]` | Written per parentRef with `controllerName`, `parentRef`, and `conditions[Accepted,ResolvedRefs]` including `observedGeneration`. |
Expand Down Expand Up @@ -231,15 +231,13 @@ The route remains `Accepted=True` and `ResolvedRefs=True`.
| --- | --- |
| `HTTPRoute.rules[].backendRefs[].filters` | Ignored entirely; the backend is programmed as if no filter existed. Permitted by the spec (implementation-specific support). |
| `HTTPRoute.rules[].retry` | Ignored; fixed 3 retries apply. |
| `HTTPRoute.rules[].timeouts` | Ignored; fixed 3000 ms timeout applies. |
| `HTTPRoute.rules[].sessionPersistence` | Ignored; random load balancing applies. |
| `Gateway.spec.addresses` | Ignored; the controller does not bind the requested address. |
| `Gateway.spec.infrastructure` | Ignored; nothing is propagated to generated resources. |

None of these broadens routing, so they are not correctness bugs of the kind §5.1 prevents, but
they are the weakest part of the current support claim and should be closed in one of two ways:
honour the field, or reject the route (`Accepted=False` / `UnsupportedValue`). Until then, this
table is the honest answer to "is my timeout honoured?" — and the answer is no.
honour the field, or reject the route (`Accepted=False` / `UnsupportedValue`).

### 5.3 Narrowed

Expand Down Expand Up @@ -269,10 +267,10 @@ profile and must not be described as such.**

### 6.1 What is declared

`GatewayClass.status.supportedFeatures` lists `Gateway`, `HTTPRoute` and `ReferenceGrant`. At
v1.5.1 the `GATEWAY-HTTP` profile's `CoreFeatures` set is exactly those three
(`conformance/utils/suite/profiles.go`), so the declaration matches the profile's core feature
set — it is a declaration of *implemented surface*, not a conformance result.
The controller advertises the three v1.5.1 core features and the two Extended HTTPRoute
timeout features. The named upstream cases are HTTPRouteTimeoutRequest and
HTTPRouteTimeoutBackendRequest. Local HTTP routing tests exercise timeout behavior for both
HTTP clients. An official conformance run is still outstanding.

### 6.2 What a core `GATEWAY-HTTP` run actually requires

Expand All @@ -294,8 +292,8 @@ a gap in §7:
| `HTTPRouteInvalidCrossNamespaceParentRef` | §7.4 wrong `Accepted` reason (`NotAllowedByListeners` expected) |
| `HTTPRouteServiceTypes` | §7.5 `Endpoints`-only backend resolution |

Everything marked *Extended* in the API reference (response header modification, rewrites,
mirrors, timeouts, CORS, backend-scoped filters, `TLSRoute`-dependent cases such as
A full run of the *Extended* suite (response header modification, rewrites,
mirrors, CORS, backend-scoped filters, `TLSRoute`-dependent cases such as
`HTTPRouteDisallowedKind`) is out of scope until the core set passes.

### 6.3 Rules for wiring the suite up
Expand Down Expand Up @@ -388,11 +386,22 @@ count, overriding hostname/path precedence.
The conformance suite can be pointed at an explicit address, so this is not a hard blocker, but a
gateway that does not publish its address is incomplete for every consumer that reads status.

### 7.10 Per-route tuning is ignored, data-plane defaults are hard-coded

`rules[].retry`, `timeouts` and `sessionPersistence` are accepted and dropped (§5.2) while
`DivideRuleHandle` is emitted with `retry=3`, `timeout=3000`, `loadBalance=RANDOM`. A route that
declares a 30 s timeout is accepted and then times out at 3 s. All three fields are Extended.
### 7.10 HTTPRoute timeouts and retry defaults

Without either timeout the generated Divide rule uses its legacy 3000 ms timeout and three retries.
Specifying either field enables separate deadlines. An omitted backend budget defaults to 3000 ms;
an omitted request budget adds no route-wide deadline. Zero disables that particular route timer.
When both values are zero, the retry count still applies, but the route imposes no time limit on
an attempt or on the retry sequence. A stalled backend then relies solely on independently
configured connection and transport timeouts. Values use the v1.5.1 Gateway API duration
grammar, including compound values such as `1s250ms`. A malformed value or a backend duration
greater than a finite explicit request duration withdraws the route and reports
`Accepted=False/UnsupportedValue`.

The request budget starts at Divide execution and includes backend selection, all attempts, backoff,
and downstream writing. Each backend attempt has a fresh budget through backend body completion.
A terminal timeout before downstream commitment yields 504. After commitment the stream terminates.
The controller still ignores `rules[].retry` and `sessionPersistence` (§5.2).

### 7.11 `backendRefs[].filters` is ignored while the route reports success

Expand Down
32 changes: 32 additions & 0 deletions issue-spec/specs/gateway-api-httproute-timeouts/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# gateway-api-httproute-timeouts

## Purpose

Define the long-lived behavior contract for this capability.

Proposal Issues:
- https://github.com/apache/shenyu/issues/8413

## Requirements

### Requirement: HTTPRoute timeout budgets

ShenYu MUST distinguish the overall HTTPRoute request deadline from the backend attempt deadline, preserving legacy routes, streaming and retry ownership.

#### Scenario: Configured route

- **WHEN** either valid v1.5.1 timeout is supplied
- **THEN** publish the two budgets independently, treating zero as disabled, an omitted attempt budget as 3000 ms, and an omitted overall budget as unbounded by the route

#### Scenario: Invalid and legacy configuration

- **WHEN** a timeout is malformed or the backend budget exceeds an explicit finite request budget
- **THEN** report UnsupportedValue and withdraw stale configuration; correcting it restores routing. Omitted or empty timeout configuration follows the legacy path.

#### Scenario: Deadline through response completion

- **WHEN** an attempt or request exceeds its finite deadline
- **THEN** cancel its actual upstream work, apply request expiry across retries and backoff, return 504 on terminal timeout before commitment and terminate a committed stream without replay. Stop attempt timing at backend body completion.

Source SPEC comments:
- https://github.com/apache/shenyu/issues/8413#issuecomment-6785307075
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class DivideRuleHandle implements RuleHandle {
*/
private long timeout = Constants.TIME_OUT;

/** Overall HTTPRoute timeout in milliseconds; null selects legacy timeout handling. */
private Long requestTimeout;

/**
* headerMaxSize.
*/
Expand Down Expand Up @@ -84,6 +87,22 @@ public class DivideRuleHandle implements RuleHandle {
*/
private String poolGroup;

/**
* Get the overall HTTPRoute request budget.
* @return milliseconds, zero for a disabled deadline, or null for legacy retry handling
*/
public Long getRequestTimeout() {
return requestTimeout;
}

/**
* Set the overall HTTPRoute request budget.
* @param requestTimeout milliseconds, zero for a disabled deadline, or null for legacy retry handling
*/
public void setRequestTimeout(final Long requestTimeout) {
this.requestTimeout = requestTimeout;
}

/**
* Gets the optional pool group name.
*
Expand Down Expand Up @@ -275,14 +294,14 @@ public boolean equals(final Object o) {
DivideRuleHandle that = (DivideRuleHandle) o;
return retry == that.retry && timeout == that.timeout && headerMaxSize == that.headerMaxSize
&& requestMaxSize == that.requestMaxSize && Objects.equals(loadBalance, that.loadBalance)
&& Objects.equals(retryStrategy, that.retryStrategy)
&& Objects.equals(requestTimeout, that.requestTimeout) && Objects.equals(retryStrategy, that.retryStrategy)
&& Objects.equals(retryBackOffSpec, that.retryBackOffSpec) && Objects.equals(canary, that.canary)
&& Objects.equals(sticky, that.sticky) && Objects.equals(poolGroup, that.poolGroup);
}

@Override
public int hashCode() {
return Objects.hash(loadBalance, retryStrategy, retryBackOffSpec, retry, timeout, headerMaxSize, requestMaxSize, canary, sticky, poolGroup);
return Objects.hash(loadBalance, retryStrategy, retryBackOffSpec, retry, timeout, requestTimeout, headerMaxSize, requestMaxSize, canary, sticky, poolGroup);
}

@Override
Expand All @@ -301,6 +320,8 @@ public String toString() {
+ retry
+ ", timeout="
+ timeout
+ ", requestTimeout="
+ requestTimeout
+ ", headerMaxSize="
+ headerMaxSize
+ ", requestMaxSize="
Expand Down
13 changes: 13 additions & 0 deletions shenyu-kubernetes-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,18 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-plugin-httpclient</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-plugin-response</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.shenyu.common.config.ssl.SslCrtAndKeyStream;

import java.util.List;
import java.util.Objects;

/**
* The configuration that shenyu can read directly.
Expand All @@ -42,6 +43,8 @@ public class ShenyuMemoryConfig {
/** Unsupported filters must surface as Accepted=False/UnsupportedValue with the rule unprogrammed. */
private boolean hasUnsupportedFilters;

private String ruleRejectionMessage;

/**
* ShenyuMemoryConfig Constructor.
*/
Expand Down Expand Up @@ -118,6 +121,25 @@ public void setUnresolvedReason(final String unresolvedReason) {
this.unresolvedReason = unresolvedReason;
}

/**
* Get the diagnostic used to withdraw the route and set Accepted=False/UnsupportedValue.
* @return the first rejected rule's diagnostic in declaration order, or null for a valid route
*/
public String getRuleRejectionMessage() {
if (hasUnsupportedFilters && Objects.isNull(ruleRejectionMessage)) {
return "route rules declare filters which are not supported by ShenYu";
}
return ruleRejectionMessage;
}

/**
* Set the first rule-level rejection diagnostic from the parser.
* @param ruleRejectionMessage diagnostic, or null if the parser accepted every rule
*/
public void setRuleRejectionMessage(final String ruleRejectionMessage) {
this.ruleRejectionMessage = ruleRejectionMessage;
}

public boolean isHasUnsupportedFilters() {
return hasUnsupportedFilters;
}
Expand Down
Loading
Loading