Skip to content

gatewayapi(extproc): use Backend FQDN hostname as gRPC :authority#8809

Open
SAY-5 wants to merge 2 commits intoenvoyproxy:mainfrom
SAY-5:fix/ext-proc-authority-backend-fqdn-8791
Open

gatewayapi(extproc): use Backend FQDN hostname as gRPC :authority#8809
SAY-5 wants to merge 2 commits intoenvoyproxy:mainfrom
SAY-5:fix/ext-proc-authority-backend-fqdn-8791

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 22, 2026

Summary

Fixes #8791.

buildExtProc in internal/gatewayapi/envoyextensionpolicy.go unconditionally set the ext_proc gRPC :authority to <backendRef-name>.<namespace>. For an in-cluster Kubernetes Service backend this matches the endpoint and works. For a Backend CRD with FQDN endpoints — i.e. an ext_proc service reached over the public internet or through a service-mesh ingress — the upstream typically routes on :authority, and the CR-name-derived authority never matches a virtual host on the other side. Users were working around this with an EnvoyPatchPolicy JSONPatch rewriting the filter config after the fact.

Fix

When the backendRef is a Backend CR (group gateway.envoyproxy.io, kind Backend) and has at least one FQDN endpoint, build :authority from <fqdn-hostname>:<fqdn-port>. Fall through to the existing <name>.<namespace>[:port] formula for:

  • Service refs
  • Backend CRs without FQDN endpoints (IP / Unix socket)
  • Any case where GetBackend returns nil (same behaviour as before)

No API change; the behaviour flips only for Backend CRs whose endpoints contain an FQDN.

Test plan

  • go build ./internal/gatewayapi/... clean
  • go vet ./internal/gatewayapi/... clean
  • go test ./internal/gatewayapi/... green (all existing translate tests pass).
  • Manual: create a Backend CR with endpoints: [{ fqdn: { hostname: my-service.example.com, port: 443 } }], attach it via EnvoyExtensionPolicy.extProc.backendRefs, and confirm the generated xDS HttpFilter -> ext_proc -> grpc_service.envoy_grpc.authority == "my-service.example.com:443" instead of <crd-name>.<namespace>.

buildExtProc unconditionally set the ext_proc gRPC :authority to
<backendRef-name>.<namespace>. For Kubernetes Service refs this is
correct, but for a Backend CRD with FQDN endpoints the upstream is
usually reached through an ingress/gateway that routes on the
:authority header (Istio, nginx, etc.). Sending the CR name there
instead of the FQDN hostname means the upstream can't find a
matching virtual host and rejects the request; users were working
around this with an EnvoyPatchPolicy that rewrote the filter config
after the fact (envoyproxy#8791).

When the backendRef is a Backend CR with at least one FQDN endpoint,
build :authority from <fqdn-hostname>:<fqdn-port>. Fall back to the
existing <name>.<namespace>[:port] form for Service refs, Backend
CRs without FQDN endpoints, and any case where GetBackend returns
nil (same behaviour as before).

Fixes envoyproxy#8791

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
@SAY-5 SAY-5 requested a review from a team as a code owner April 22, 2026 02:44
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 781def4
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69e87c03e287430008b0af2c
😎 Deploy Preview https://deploy-preview-8809--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: 5eec026fd7

ℹ️ 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 +858 to +859
if backendRef.Group != nil && string(*backendRef.Group) == egv1a1.GroupName &&
backendRef.Kind != nil && string(*backendRef.Kind) == egv1a1.KindBackend {
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 Detect Backend refs even when group is omitted

The FQDN authority branch now requires both backendRef.Group and backendRef.Kind to be explicitly set, but validateExtServiceBackendReference still accepts kind: Backend with an omitted/empty group and the translator still processes that as a Backend reference. In that valid configuration, this condition is skipped and authority falls back to <name>.<namespace>[:port], so FQDN-backed ExtProc calls keep the original misrouted :authority value. Please key this check off effective kind (and defaulted group semantics) so omitted-group Backend refs also get FQDN authority.

Useful? React with 👍 / 👎.

@arkodg arkodg requested a review from guydc April 22, 2026 03:39
…uthority

Codex review on envoyproxy#8809 flagged that the FQDN-authority branch required
backendRef.Group to be explicitly set to egv1a1.GroupName, but
validateExtServiceBackendReference / ext_service.go already accept
Kind: Backend with the group field omitted (defaulted). That valid
config would bypass the FQDN lookup and fall back to the misrouted
<name>.<namespace>[:port] authority for users who wrote just:

  backendRefs:
    - kind: Backend
      name: my-ext-proc

Switch to KindDerefOr + GroupDerefOr with defaults matching the
validator so both the explicit-group and omitted-group shapes resolve
Backend refs consistently. Service backendRefs are unaffected:
KindDerefOr defaults Kind to empty so the Backend gate stays false.

The backendtrafficpolicy-dns-lookup-family golden now carries the
real FQDN hostname (backend-v2.gateway-conformance-infra.svc.cluster.local:9090)
instead of the incorrect backend-fqdn2.default:9090 that fell out of
the previous buggy path. This is the whole point of the patch.

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
@SAY-5
Copy link
Copy Markdown
Author

SAY-5 commented Apr 22, 2026

Good catch, @chatgpt-codex-connector — the strict pointer check would have skipped the (valid) omitted-group form and fallen back to the misrouted <name>.<namespace>[:port] authority, which is exactly what #8791 was about. Switched both the Kind and Group comparisons to KindDerefOr / GroupDerefOr with defaults matching validateExtServiceBackendReference, so kind: Backend now resolves the FQDN whether or not group is spelled out. Also refreshed the backendtrafficpolicy-dns-lookup-family golden to carry the real FQDN hostname (backend-v2.gateway-conformance-infra.svc.cluster.local:9090) instead of the previous misrouted backend-fqdn2.default:9090.

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

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.

ext_proc gRPC authority should use Backend FQDN hostname, not CRD name

1 participant