Skip to content

fix: stale HTTPRoute/GRPCRoute/TLSRoute/TCPRoute/UDPRoute status after gateway-only spec changes#8876

Open
yuehaii wants to merge 6 commits intoenvoyproxy:mainfrom
yuehaii:main
Open

fix: stale HTTPRoute/GRPCRoute/TLSRoute/TCPRoute/UDPRoute status after gateway-only spec changes#8876
yuehaii wants to merge 6 commits intoenvoyproxy:mainfrom
yuehaii:main

Conversation

@yuehaii
Copy link
Copy Markdown

@yuehaii yuehaii commented Apr 28, 2026

What type of PR is this?
fix: stale HTTPRoute/GRPCRoute/TLSRoute/TCPRoute/UDPRoute/ status after gateway-only spec changes

Issue description
When a Gateway resource is updated without touching any Route resource (e.g. a listener hostname or allowedRoutes change), the Route's status.parents[*].conditions become stale, the observedGeneration field continues pointing at the old gateway generation instead of the new one.

Root cause
The bug only manifests as False→False (same outcome, only ObservedGeneration should advance). If the gateway update trigger a new route reconcile, GetGeneration() hasn't changed because the route was not modified. So the newly computed condition is byte-for-byte identical to what's already in the store and never trigger the status update.

Fix
Compute observedGeneration as the max of route and gateway generation at the top of each parentRef loop iteration, and use it only for gateway-driven conditions.

Verification

  1. unit test

go test ./internal/gatewayapi/runner/... -v -run "TestHTTPRouteStatusStaleAfterAllowedRoutesChange" -count=1 2>&1 | tail -15
=== RUN TestHTTPRouteStatusStaleAfterAllowedRoutesChange
--- PASS: TestHTTPRouteStatusStaleAfterAllowedRoutesChange (0.15s)
PASS
1.777439888886663e+09 info gateway-api runner/runner.go:557 shutting down {"runner": "gateway-api"}
ok github.com/envoyproxy/gateway/internal/gatewayapi/runner 1.612s

go test ./internal/gatewayapi/runner/... -v -run TestHTTPRouteStatusStaleAfterListenerHostnameChange -count=1 2>&1 | tail -50
=== RUN TestHTTPRouteStatusStaleAfterListenerHostnameChange
--- PASS: TestHTTPRouteStatusStaleAfterListenerHostnameChange (0.15s)
PASS
1.7774398311383302e+09 info gateway-api runner/runner.go:557 shutting down {"runner": "gateway-api"}
ok github.com/envoyproxy/gateway/internal/gatewayapi/runner 1.663s

  1. integration test

Step 1 — Bug Reproduction (unpatched controller)

Setup: Gateway listener on other.example.com, HTTPRoute hostname test.example.com (no match).

Step Gateway gen Accepted condition observedGeneration
Create gateway + route 1 False / NoMatchingListenerHostname 1
Add matching listener (gateway-only edit) 2 False / NoMatchingListenerHostname ❌ (stale — should be True) still 1 ❌

Step 2 — Fix Verification (patched controller)

Step Gateway gen Accepted condition observedGeneration
Reset: only other.example.com listener 3 False / NoMatchingListenerHostname 3
Add another.example.com (same False outcome, only gen changes) 4 False / NoMatchingListenerHostname 4 ✅
Add matching test.example.com listener 5 True / Accepted 5 ✅

Which issue(s) this PR fixes:
Fixes #8861

Release Notes: Yes

yuehaii added 2 commits April 28, 2026 12:05
…r gateway-only spec changes

Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
@yuehaii yuehaii requested a review from a team as a code owner April 28, 2026 04:25
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit b0e2649
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69f19734176f4a0008fe1fd8
😎 Deploy Preview https://deploy-preview-8876--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.

Copy link
Copy Markdown

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

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: 9f6c48c111

ℹ️ 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 thread internal/gatewayapi/route.go
yuehaii added 3 commits April 28, 2026 13:56
…edGeneration

Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: Hai <20416005+yuehaii@users.noreply.github.com>
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.

HTTPRoute status condition not refreshed when listener configuration changes (NoMatchingListenerHostname stale)

1 participant