Repository navigation
feat: add hostname field to active gRPC health checks - #10093
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
| @@ -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: | |||
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
|
Thank you for the review @hsubramanianaks! I addressed your comments in the latest commit, it should cover everything. |
Signed-off-by: Guillaume Cléroux <[email protected]>
Signed-off-by: Guillaume Cléroux <[email protected]>
1bbafcb to
52d87eb
Compare
|
@hsubramanianaks Sorry for the force push, evidently I'm still struggling with DCO and didn't annotate the commits... |
|
Hi @gcleroux to pass the |
|
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 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. |
…health-check Signed-off-by: Guillaume Cléroux <[email protected]>
6af7916 to
5efaaa0
Compare
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 👍 / 👎.
| `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 |
There was a problem hiding this comment.
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 👍 / 👎.
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/0Slashes 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 theHostnamefield 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
git commit -s). See DCO: Sign your work./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.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.)release-notes/current/<section>/<pr-number>-<slug>.md(seerelease-notes/current/README.mdfor sections and naming). N/A if this PR does not contain non-trivial changes.make gen-checkand committed the result if API/helm charts/modules changed.release-notes/current/breaking_changes/.