Skip to content

feat: add hostname field to active gRPC health checks - #10093

Merged
zirain merged 6 commits into
envoyproxy:mainfrom
gcleroux:feat/grpc-hostname-health-check
Oct 26, 2026
Merged

zirain merged 6 commits into
envoyproxy:mainfrom
gcleroux:feat/grpc-hostname-health-check

Conversation

@gcleroux

@gcleroux gcleroux commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Envoy Gateway only set service_name on the gRPC health checker, leaving authority empty. Envoy then defaults that header to the cluster name, which Envoy Gateway generates per route rule:

:authority: grpcroute/my-ns/my-route/rule/0

Slashes aren't valid in an authority (RFC 3986), and Go gRPC servers built on golang.org/x/net v0.59.0+ (golang/net@580cba3) now reject it with PROTOCOL_ERROR. Every endpoint gets marked failed_active_hc and clients see no healthy upstream from a perfectly healthy backend. There was no way to override it.

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

Notes:
This PR contains small changes to api/ to add the Hostname field to GRPC health check. This change was not preemptively agreed upon as of submitting this PR. However, I reused the same field naming convention that HTTP health checks use and it seemed fairly intuitive.

I think the scope of this PR is small enough to be submitted as is, let me know if it should be split.


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: If this PR contains API changes (changes under /api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.
  • Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: User-facing changes update the docs, either in this PR or a follow-up PR. N/A if this PR does not contain user-facing changes.
  • Release notes: For any non-trivial change, added a release-note fragment under release-notes/current/<section>/<pr-number>-<slug>.md (see release-notes/current/README.md for sections and naming). N/A if this PR does not contain non-trivial changes.
  • Generated files committed: Ran make gen-check and committed the result if API/helm charts/modules changed.
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments.

@gcleroux
gcleroux requested a review from a team as a code owner September 23, 2026 15:48
@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 4c8982c
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6adeb32ffd7cc1d6addfc378
😎 Deploy Preview https://deploy-preview-10093--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.

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.03%. Comparing base (e6e2060) to head (4c8982c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10093      +/-   ##
==========================================
+ Coverage   82.01%   82.03%   +0.02%     
==========================================
  Files         269      269              
  Lines       42716    42726      +10     
==========================================
+ Hits        35032    35051      +19     
+ Misses       7683     7674       -9     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -50011,6 +50059,18 @@ spec:
GRPC defines the configuration of the GRPC health checker.
It's optional, and can only be used if the specified type is GRPC.
properties:
hostname:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we add an e2e test for the original failure? The unit tests cover hostname selection, but it would be good to verify that an actual gRPC health check succeeds against a backend that rejects malformed authorities. Ideally, cover both an explicit hostname and the route-hostname fallback.

irHC.GRPC = &ir.GRPCHealthChecker{
Service: ptr.Deref(hc.GRPC, egv1a1.GRPCActiveHealthChecker{}).Service,
Service: grpc.Service,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hostname validation looks right. Could we add cases under  test/cel-validation  to cover it? An omitted or valid hostname should pass, while an empty string, wildcard, slash-containing value, or value over 253 characters should fail.

@hsubramanianaks hsubramanianaks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Release note clarification:

Could we mention that users with wildcard or no route hostname may still need to set  grpc.hostname  explicitly? Without an endpoint hostname, those cases still fall back to the cluster name, so upgrading alone won’t resolve the issue for everyone.

@gcleroux

Copy link
Copy Markdown
Contributor Author

Thank you for the review @hsubramanianaks!

I addressed your comments in the latest commit, it should cover everything.

@gcleroux
gcleroux force-pushed the feat/grpc-hostname-health-check branch from 1bbafcb to 52d87eb Compare September 25, 2026 03:15
@gcleroux

Copy link
Copy Markdown
Contributor Author

@hsubramanianaks Sorry for the force push, evidently I'm still struggling with DCO and didn't annotate the commits...

@zhaohuabing zhaohuabing added this to the v1.10.0-rc.1 Release milestone Sep 29, 2026
@zhaohuabing

zhaohuabing commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Hi @gcleroux to pass the gen-check, could you please run make -k gen-check and submit the generated files?

@hsubramanianaks

hsubramanianaks commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

@gcleroux

To fix the failing build and gen-check,

Please update your branch with latest main, then regenerate and verify:

Use the remote pointing to envoyproxy/gateway.

git fetch upstream
git merge upstream/main

Regenerate the xDS translator fixtures.

go test ./internal/xds/translator -count=1 -args --override-testdata=true

Verify against the regenerated fixtures.

go test ./internal/xds/translator -count=1

Review generated changes.

git diff -- internal/xds/translator/testdata/out/

Replace upstream with origin if that is your upstream repository remote. The regeneration run may report the old mismatch because expected fixtures are embedded at compilation; the verification run should pass. Commit any necessary generated changes.
Run regeneration for the whole package, without -run: the fixture cleanup can otherwise delete outputs for skipped cases.

@gcleroux
gcleroux force-pushed the feat/grpc-hostname-health-check branch from 6af7916 to 5efaaa0 Compare October 13, 2026 18:28
Comment thread examples/grpc-health-backend/go.mod Resolved
@zirain

zirain commented Oct 20, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T02:02:25.816743Z 4c8982c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: d2524ea03a

ℹ️ 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".

{
name: "cluster name used as authority",
authority: "grpcroute/gateway-conformance-infra/grpc-route/rule/0",
wantCode: codes.InvalidArgument,

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 Expect the transport-level malformed-authority status

With golang.org/x/net v0.60.0 declared by this example, the slash-containing :authority is rejected while decoding the HTTP/2 headers, before checkAuthority's interceptor can return InvalidArgument; gRPC therefore surfaces the PROTOCOL_ERROR stream reset instead, so go test in examples/grpc-health-backend fails this new case. Assert the transport-level result or exercise checkAuthority directly.

Useful? React with 👍 / 👎.

Comment on lines +6 to +8
`no healthy upstream` from a healthy backend. The authority now defaults to the effective route
hostname, mirroring the HTTP health checker, and `BackendTrafficPolicy` gained
`healthCheck.active.grpc.hostname` to set it explicitly. Upgrading alone does not fix routes with a

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 Call out merged clusters in the hostname caveat

When mergeBackends is enabled and the health check comes from a Gateway- or backend-scoped policy, BackendClusterTranslator deliberately supplies an empty routeHostname (internal/xds/translator/cluster.go:1703), while ordinary Service endpoints are created without endpoint hostnames (internal/gatewayapi/route.go:3386). Consequently even an exact-hostname GRPCRoute still falls back to the slash-containing merged cluster name unless grpc.hostname is explicit, so the statement that the authority now defaults to the effective route hostname omits a supported mode in which upgrading alone does not fix the outage; document this requirement or provide a valid merged-cluster fallback.

Useful? React with 👍 / 👎.

@arkodg
arkodg requested review from a team October 26, 2026 01:53
@zirain
zirain merged commit c86f8aa into envoyproxy:main Oct 26, 2026
74 of 78 checks passed
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.

gRPC active health check sends invalid :authority

5 participants