Skip to content

docs: add GRPC Timeouts task (BackendTrafficPolicy) - #9631

Open
guanchzhou wants to merge 3 commits into
envoyproxy:mainfrom
guanchzhou:eg-grpc-timeouts-docs
Open

docs: add GRPC Timeouts task (BackendTrafficPolicy)#9631
guanchzhou wants to merge 3 commits into
envoyproxy:mainfrom
guanchzhou:eg-grpc-timeouts-docs

Conversation

@guanchzhou

Copy link
Copy Markdown
Contributor

What this PR does

Adds a GRPC Timeouts task doc (site/content/en/latest/tasks/traffic/grpc-timeouts.md) showing how to configure timeouts for gRPC traffic with a BackendTrafficPolicy.

Why

The Gateway API GRPCRoute resource has no native timeouts field yet — it's tracked upstream at kubernetes-sigs/gateway-api#3139 (triage/accepted, priority/important-longterm), and GRPCRouteRule in the current CRD still lacks it. In the meantime Envoy Gateway already supports gRPC timeouts via BackendTrafficPolicy (closing #6511 for unary and #5446 / #6508 for streaming), but this isn't documented, so users keep rediscovering it by word of mouth (e.g. the workaround reshared in kubernetes-sigs/gateway-api#3139). This doc closes that gap.

Contents

  • Unary RPCstimeout.http.requestTimeout bounds the request.
  • Streaming RPCsrequestTimeout: "0s" disables the per-request timeout so long-lived streams aren't cut off, then maxStreamDuration / streamIdleTimeout bound them (with "0s" = indefinite).
  • Explains the fields and links the upstream tracking issue for the eventual native field.

Docs-only; no code change. Follows the existing http-timeouts.md structure and the established BackendTrafficPolicy API-reference link convention. markdownlint-clean (no trailing whitespace, consistent heading levels).

GRPCRoute has no native timeouts field yet (tracked upstream at
kubernetes-sigs/gateway-api#3139), and users repeatedly rediscover the
BackendTrafficPolicy workaround by word of mouth. Document how to configure
gRPC timeouts via BackendTrafficPolicy: requestTimeout for unary RPCs, and
requestTimeout: 0s + maxStreamDuration/streamIdleTimeout for streaming RPCs.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@guanchzhou
guanchzhou requested a review from a team as a code owner July 31, 2026 12:39
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 21943e4
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a6cd8d9bd229a00086275c7
😎 Deploy Preview https://deploy-preview-9631--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b48b662050

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +95 to +98
targetRefs:
- group: gateway.networking.k8s.io
kind: GRPCRoute
name: yages

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid applying two policies to the same GRPCRoute

When readers follow this task top-to-bottom, the unary example has already created a BackendTrafficPolicy targeting GRPCRoute/yages, and this streaming example creates a second policy for that same route. Envoy Gateway processes BackendTrafficPolicies in creation order and resolveBackendTrafficPolicyRouteTargetRef rejects a later policy that targets an already-attached route as Conflicted, so grpc-stream-timeout will not be accepted and the streaming timeout settings won't take effect unless the reader deletes/reuses the first policy or uses a separate route.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 2c85563. Both examples now reuse a single BackendTrafficPolicy named grpc-timeouts, and I added a note in Prerequisites that a GRPCRoute accepts only one BackendTrafficPolicy (a second is rejected as Conflicted), so the two examples are alternatives and re-applying updates the same policy rather than creating a conflicting second one.

…-timeouts examples

A GRPCRoute accepts only one BackendTrafficPolicy; a second policy targeting the same
route is rejected as Conflicted (backendtrafficpolicy.go resolveBackendTrafficPolicyRouteTargetRef).
The unary and streaming examples now reuse a single policy name (grpc-timeouts) and a note
explains they are alternatives, so following the task top-to-bottom no longer produces a
Conflicted second policy.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@jukie

jukie commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Can you include an example and a way to "prove" the timeouts work as expected?

- Correct the HTTPRoute/GRPCRoute links to the /reference/api-types/ path used by the
  other traffic docs (the /api-types/ form 404s, failing docs-lint link check).
- Address review: add a Verification step that proves the timeout is programmed into the
  Envoy route config via egctl (route timeout / maxStreamDuration), plus an end-to-end
  grpcurl DEADLINE_EXCEEDED example and a note that the sample yages backend does not delay.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@guanchzhou

Copy link
Copy Markdown
Contributor Author

Thanks @jukie — added in 21943e4. The Verification section now:

  1. Shows how to prove the timeout is programmed into the Envoy route config with egctl config envoy-proxy route (you should see the route timeout equal to requestTimeout for the unary case, and timeout: 0s + maxStreamDuration for the streaming case).
  2. Adds an end-to-end example with grpcurl showing a call that exceeds the timeout returning DEADLINE_EXCEEDED (HTTP 504).

I called out that the sample yages echo backend from the GRPC Routing task returns immediately, so a true end-to-end trigger test needs a backend that can delay/stream — happy to wire up a delaying backend into the example if you'd prefer a fully copy-pasteable e2e repro.

Also fixed the docs-lint failure (the HTTPRoute/GRPCRoute links now use the /reference/api-types/ path the other traffic docs use; the /api-types/ form was 404ing).

@arkodg arkodg added this to the v1.9.0 Release milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants