Skip to content

docs: add EnvoyPatchPolicy cluster patching example - #9949

Open
amarkdotdev wants to merge 1 commit into
envoyproxy:mainfrom
amarkdotdev:docs/7306-envoypatchpolicy-cluster
Open

docs: add EnvoyPatchPolicy cluster patching example#9949
amarkdotdev wants to merge 1 commit into
envoyproxy:mainfrom
amarkdotdev:docs/7306-envoypatchpolicy-cluster

Conversation

@amarkdotdev

Copy link
Copy Markdown
Contributor

Summary

  • Add a working example for patching Cluster resources with EnvoyPatchPolicy
  • Document the cluster name format: httproute/<HTTPRouteNamespace>/<HTTPRouteName>/rule/<RuleIndex>
  • Add cluster name to the xDS Name Scheme table
  • Explain using replace instead of add for load_balancing_policy since clusters already have a default policy
  • Show how to verify patches with egctl x translate

Test plan

  • Build the docs site locally and verify the new section renders correctly
  • Verify the cluster name format matches generated xDS output
  • Confirm the example YAML structure matches EnvoyPatchPolicy API expectations

Fixes #7306

@amarkdotdev
amarkdotdev requested a review from a team as a code owner September 4, 2026 07:37
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

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

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

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

kind: EnvoyPatchPolicy
metadata:
name: server-route-client-wrr
namespace: envoy-poc

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 Use resources created by the documented prerequisites

When a reader follows this page from the prerequisites, the quickstart creates the eg Gateway and backend HTTPRoute in default (examples/kubernetes/quickstart.yaml:8-17,72-91), but it never creates the envoy-poc namespace or server-route. Consequently this supposedly applicable example fails immediately because the namespace is absent, or cannot find the target cluster if the reader happens to have created that namespace. Reuse default/backend or add the missing namespace, Gateway, and HTTPRoute manifests.

Useful? React with 👍 / 👎.

group: gateway.networking.k8s.io
kind: Gateway
name: eg
namespace: envoy-poc

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 Remove the unsupported targetRef namespace

EnvoyPatchPolicy.spec.targetRef is a LocalPolicyTargetReference, and the generated CRD permits only group, kind, and name under this field (charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoypatchpolicies.yaml:135-165). Thus namespace is rejected by strict field validation or pruned with a warning rather than selecting the target namespace; attachment is already scoped by the policy's own namespace. Remove this field from both copies of the example.

Useful? React with 👍 / 👎.

cluster configuration with [egctl x translate][]:

```shell
egctl x translate --from gateway-api -o yaml | yq '.clusters.dynamicActiveClusters[] | select(.cluster.name == "httproute/envoy-poc/server-route/rule/0")'

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 Provide the required input to the translate command

This verification command cannot execute as shown: egctl x translate --help defines --file/-f as required (also visible in internal/cmd/egctl/translate.go:92-113), while this invocation supplies neither a file nor stdin. Moreover, translated cluster output is nested below .xds.<config-key>.dynamicActiveClusters, not .clusters (internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.cluster.yaml:1-5). Supply the relevant Gateway API input and correct the query, or use egctl config envoy-proxy cluster to inspect the live patched proxy.

Useful? React with 👍 / 👎.

Comment on lines +124 to +125
| **Cluster name** | Old | `httproute/<HTTPRouteNamespace>/<HTTPRouteName>/rule/<RuleIndex>` | `default/backend/rule/0` |
| | V2 | `httproute/<HTTPRouteNamespace>/<HTTPRouteName>/rule/<RuleIndex>` | `default/backend/rule/0` |

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 Include the httproute prefix in cluster examples

The example contradicts the format in the same row: generated HTTPRoute cluster names include the leading httproute/ segment, as confirmed throughout the translation fixtures (for example internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.cluster.yaml:34). Readers copying default/backend/rule/0 will therefore target no xDS resource. Change both Old and V2 examples to httproute/default/backend/rule/0.

Useful? React with 👍 / 👎.

Document how to patch Cluster resources with EnvoyPatchPolicy,
including cluster name format and a working load balancing policy
example using replace instead of add.

Fixes envoyproxy#7306

Signed-off-by: amarkdotdev <amark@g.jct.ac.il>
Signed-off-by: Aaron <amark@g.jct.ac.il>
@amarkdotdev
amarkdotdev force-pushed the docs/7306-envoypatchpolicy-cluster branch from a1f3a8b to 1496eb6 Compare September 4, 2026 08:00
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.

How to patch Cluster with EnvoyPatchPolicy

1 participant