api: add xds translator configuration to EnvoyProxy #10740
<span aria-hidden="true">✅</span> Deploy Preview for cerulean-figolla-1f9435 ready!
Built without sensitive environment variables
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 0eef4bb7b6fc68954ad4cbfadd44a8b3500465ac |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6b0d746e1c23005bc8289af3 |
|<span aria-hidden="true">😎</span> Deploy Preview | https://deploy-preview-10740--cerulean-figolla-1f9435.netlify.app |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />!QR Code<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- cerulean-figolla-1f9435 Preview -->
_To edit notification comments on pull requests, go to your Netlify project configuration._
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"0eef4bb7b6fc68954ad4cbfadd44a8b3500465ac","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
<details>
<summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-30T13:14:51.267549Z">2026-11-30T13:14:51.267549Z</relative-time> | 0eef4bb | Draft marked ready |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your 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.
</details>
</details>
<sub><sub>!P2 Badge</sub></sub> Use one namespace in the endpoint metadata contract
When an implementer or user follows this new contract, these statements select different metadata locations: the expression treats envoy-gateway as the filter-metadata namespace and backend/name as its field path (the same syntax exercised by %METADATA(ROUTE:envoy-gateway:resources)% in test/e2e/testdata/accesslog-otel.yaml:37), while the preceding sentence calls envoy-gateway.backend the namespace. Depending on which statement the implementation follows, either lookups using the advertised namespace or the provided access-log expression will return no value; document this as namespace envoy-gateway plus a backend field, or change the expression to match the dotted namespace.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0eef4bb7b6
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 82.83%. Comparing base (
a50bb96) to head (0eef4bb).<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #10740 +/- ##
==========================================
- Coverage 82.84% 82.83% -0.01%
==========================================
Files 279 279
Lines 44687 44687
==========================================
- Hits 37019 37018 -1
- Misses 7667 7668 +1
Partials 1 1
</details>
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
overall LGTM
nit: the namespace is envoy-gateway and backend is a key inside it, which is what the %METADATA(UPSTREAM_HOST:envoy-gateway:backend:name)% example assumes. As written, this reads like one dotted namespace envoy-gateway.backend.
// endpoint in the generated xDS, under the `backend` key of the `envoy-gateway` filter metadata namespace.
Could we drop the per-field toggles and just let a non-nil value enable it, like mergeBackends? Turning off a field saves only a few bytes per endpoint, and a fixed set of keys is easier to rely on in access logs. We can add them later if needed.
Reading #9408, both cases look covered already by the backend identity on each endpoint group. I tried %CEL(xds.upstream_host_locality_metadata.filter_metadata['envoy-gateway']['resources'][0]['name'])% against a cluster with two weighted backendRefs in different namespaces, and every log line named the backend that served the request.
Maybe there's a case this doesn't cover that I'm not seeing? If not, documenting that expression might be enough, without new API or per-endpoint xDS.
@zhaohuabing Thanks so much! %CEL(xds.upstream_host_locality_metadata.filter_metadata['envoy-gateway']['resources'][0]['name'])% was completely new to me. I switch over to use that in our dev clusters and that just works out of the box no patches or api changes required.
accessLog:
settings:
- format:
type: JSON
json:
...
# This needs changes in envoy-gateway to attach metadata to endpoints - available in our patched version
#upstream_service: "%METADATA(UPSTREAM_HOST:envoy-gateway:backend:name)%"
#namespace_extracted: "%METADATA(UPSTREAM_HOST:envoy-gateway:backend:namespace)%"
upstream_service: "%CEL(xds.upstream_host_locality_metadata.filter_metadata['envoy-gateway']['resources'][0]['name'])%"
namespace_extracted: "%CEL(xds.upstream_host_locality_metadata.filter_metadata['envoy-gateway']['resources'][0]['namespace'])%"
...
I will close this and the other PR.
zirain
mgs255
Proposal for extension to EnvoyProxy API to allow configuration of metadata generation.
What this PR does / why we need it:
Replaces the
LbEndpointMetadataruntime flag proposed in #10224 with a properEnvoyProxyAPI, per review feedback (flags are for temporary rollouts, xDS size is a long-term concern, and per-proxy control ispreferable).
Adds optional
EnvoyProxy.spec.xds.metadata.endpoint, which attaches backend identity to each endpoint in the generated xDS under theenvoy-gateway.backendfilter metadata namespace. It's usable in accesslogs, e.g.
%METADATA(UPSTREAM_HOST:envoy-gateway:backend:name)%.- Disabled when unset, to avoid churning existing xDS and test fixtures. Setting
endpoint(even empty) enables it with all fields.-
kind,name,namespaceandsectionNamecan each be set tofalseto reduce xDS size.- The
xds.metadatanesting leaves room for other optional xDS settings later without a breaking change.API only (types, generated code, API docs). The implementation will follow once the API is agreed.
Which issue(s) this PR fixes:
Related to #10224
---
PR Checklist
- [x] 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.
- [x] 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, butthe 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, butgen-check,lint, and coverage MUSTpass.)
- [x] Tests added/updated: N/A: API types only, no behavioral code yet.
- [x] Docs: N/A: generated API reference is updated; user docs will come with the implementation.
- [x] Release notes: N/A: not user-visible until implemented.
- [x] Generated files committed: Ran
make gen-checkand 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.