Skip to content

Commit 69822b9

Browse files
author
Arko Dasgupta
committed
fix docs
Signed-off-by: Arko Dasgupta <[email protected]>
1 parent f744e8c commit 69822b9

File tree

1 file changed

+48
-25
lines changed

1 file changed

+48
-25
lines changed

docs/latest/design/envoy-patch-policy.md

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,66 @@ Here is an example highlighting how a user can configure global ratelimiting usi
3131

3232
```
3333
apiVersion: gateway.networking.k8s.io/v1beta1
34+
kind: GatewayClass
35+
metadata:
36+
name: eg
37+
spec:
38+
controllerName: gateway.envoyproxy.io/gatewayclass-controller
39+
---
40+
apiVersion: gateway.networking.k8s.io/v1beta1
3441
kind: Gateway
3542
metadata:
36-
name: eg-gw
43+
name: eg
3744
namespace: default
3845
spec:
39-
gatewayClassName: eg-gc
46+
gatewayClassName: eg
4047
listeners:
41-
- name: example
42-
protocol: HTTPS
43-
port: 443
44-
hostname: example.com
45-
tls:
46-
certificateRefs:
47-
- kind: Secret
48-
group: ""
49-
name: example-cert
50-
---
48+
- name: http
49+
protocol: HTTP
50+
port: 80
51+
---
52+
apiVersion: gateway.networking.k8s.io/v1beta1
53+
kind: HTTPRoute
54+
metadata:
55+
name: backend
56+
namespace: default
57+
spec:
58+
parentRefs:
59+
- name: eg
60+
hostnames:
61+
- "www.example.com"
62+
rules:
63+
- backendRefs:
64+
- group: ""
65+
kind: Service
66+
name: backend
67+
port: 3000
68+
weight: 1
69+
matches:
70+
- path:
71+
type: PathPrefix
72+
value: /
73+
---
5174
apiVersion: gateway.envoyproxy.io/v1alpha1
5275
kind: EnvoyPatchPolicy
5376
metadata:
5477
name: ratelimit-patch-policy
5578
namespace: default
5679
spec:
5780
targetRef:
58-
group: gateway.networking.k8s.io/v1beta1
81+
group: gateway.networking.k8s.io
5982
kind: Gateway
60-
name: eg-gw
83+
name: eg
6184
namespace: default
6285
type: JSONPatch
6386
jsonPatches:
6487
- type: "type.googleapis.com/envoy.config.listener.v3.Listener"
65-
# The listener name is of the form <GatewayNamespace>-<GatewayName>-<GatewayListenerName>
66-
name: default-eg-gw-example
88+
# The listener name is of the form <GatewayNamespace>/<GatewayName>/<GatewayListenerName>
89+
name: default/eg/http
6790
operation:
6891
op: add
69-
path: "/filter_chains/0/filters/0/http_filters/0"
70-
value: |
92+
path: "/default_filter_chain/filters/0/typed_config/http_filters/0"
93+
value:
7194
name: "envoy.filters.http.ratelimit"
7295
typed_config:
7396
"@type": "type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit"
@@ -80,20 +103,20 @@ spec:
80103
cluster_name: rate-limit-cluster
81104
transport_api_version: V3
82105
- type: "type.googleapis.com/envoy.config.route.v3.RouteConfiguration"
83-
# The route name is of the form <GatewayNamespace>-<GatewayName>-<GatewayListenerName>
84-
name: default-eg-gw-example
106+
# The route name is of the form <GatewayNamespace>/<GatewayName>/<GatewayListenerName>
107+
name: default/eg/http
85108
operation:
86109
op: add
87110
path: "/virtual_hosts/0/rate_limits"
88-
value: |
111+
value:
89112
- actions:
90113
- remote_address: {}
91-
- type: "type.googleapis.com/envoy.config.cluster.v3.Cluster"
114+
- type: "type.googleapis.com/envoy.config.cluster.v3.Cluster"
92115
name: rate-limit-cluster
93116
operation:
94117
op: add
95-
path: "/"
96-
value: |
118+
path: ""
119+
value:
97120
name: rate-limit-cluster
98121
type: STRICT_DNS
99122
connect_timeout: 10s
@@ -107,7 +130,7 @@ spec:
107130
address:
108131
socket_address:
109132
address: ratelimit.svc.cluster.local
110-
port_value: 8081
133+
port_value: 8081
111134
```
112135

113136

0 commit comments

Comments
 (0)