Skip to content

Commit 2bc64d0

Browse files
rudrakhpshawnh2
authored andcommitted
fix: validation for grpc routes with extension ref filters (envoyproxy#6949)
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com> Signed-off-by: shawnh2 <shawnhxh@outlook.com>
1 parent 5446f0d commit 2bc64d0

File tree

3 files changed

+233
-1
lines changed

3 files changed

+233
-1
lines changed

internal/gatewayapi/filters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (t *Translator) ProcessGRPCFilters(parentRef *RouteParentContext,
136136
if httpFiltersContext.DirectResponse != nil {
137137
break
138138
}
139-
if err := ValidateGRPCRouteFilter(&filter); err != nil {
139+
if err := ValidateGRPCRouteFilter(&filter, t.ExtensionGroupKinds...); err != nil {
140140
t.processInvalidHTTPFilter(string(filter.Type), httpFiltersContext, err)
141141
break
142142
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
gateways:
2+
- apiVersion: gateway.networking.k8s.io/v1
3+
kind: Gateway
4+
metadata:
5+
namespace: envoy-gateway
6+
name: gateway-1
7+
spec:
8+
gatewayClassName: envoy-gateway-class
9+
listeners:
10+
- name: http
11+
protocol: HTTP
12+
port: 80
13+
allowedRoutes:
14+
namespaces:
15+
from: All
16+
grpcRoutes:
17+
- apiVersion: gateway.networking.k8s.io/v1alpha2
18+
kind: GRPCRoute
19+
metadata:
20+
namespace: default
21+
name: grpcroute-1
22+
spec:
23+
parentRefs:
24+
- namespace: envoy-gateway
25+
name: gateway-1
26+
sectionName: http
27+
rules:
28+
- matches:
29+
- method:
30+
service: com.example.Service
31+
type: Exact
32+
backendRefs:
33+
- name: service-1
34+
port: 8080
35+
filters:
36+
- type: ExtensionRef
37+
extensionRef:
38+
group: foo.example.io
39+
kind: Foo
40+
name: test
41+
extensionRefFilters:
42+
- apiVersion: foo.example.io/v1alpha1
43+
kind: Foo
44+
metadata:
45+
name: test
46+
namespace: default
47+
spec:
48+
data: "stuff"
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
gateways:
2+
- apiVersion: gateway.networking.k8s.io/v1
3+
kind: Gateway
4+
metadata:
5+
creationTimestamp: null
6+
name: gateway-1
7+
namespace: envoy-gateway
8+
spec:
9+
gatewayClassName: envoy-gateway-class
10+
listeners:
11+
- allowedRoutes:
12+
namespaces:
13+
from: All
14+
name: http
15+
port: 80
16+
protocol: HTTP
17+
status:
18+
listeners:
19+
- attachedRoutes: 1
20+
conditions:
21+
- lastTransitionTime: null
22+
message: Sending translated listener configuration to the data plane
23+
reason: Programmed
24+
status: "True"
25+
type: Programmed
26+
- lastTransitionTime: null
27+
message: Listener has been successfully translated
28+
reason: Accepted
29+
status: "True"
30+
type: Accepted
31+
- lastTransitionTime: null
32+
message: Listener references have been resolved
33+
reason: ResolvedRefs
34+
status: "True"
35+
type: ResolvedRefs
36+
name: http
37+
supportedKinds:
38+
- group: gateway.networking.k8s.io
39+
kind: HTTPRoute
40+
- group: gateway.networking.k8s.io
41+
kind: GRPCRoute
42+
grpcRoutes:
43+
- apiVersion: gateway.networking.k8s.io/v1alpha2
44+
kind: GRPCRoute
45+
metadata:
46+
creationTimestamp: null
47+
name: grpcroute-1
48+
namespace: default
49+
spec:
50+
parentRefs:
51+
- name: gateway-1
52+
namespace: envoy-gateway
53+
sectionName: http
54+
rules:
55+
- backendRefs:
56+
- name: service-1
57+
port: 8080
58+
filters:
59+
- extensionRef:
60+
group: foo.example.io
61+
kind: Foo
62+
name: test
63+
type: ExtensionRef
64+
matches:
65+
- method:
66+
service: com.example.Service
67+
type: Exact
68+
status:
69+
parents:
70+
- conditions:
71+
- lastTransitionTime: null
72+
message: Route is accepted
73+
reason: Accepted
74+
status: "True"
75+
type: Accepted
76+
- lastTransitionTime: null
77+
message: Resolved all the Object references for the Route
78+
reason: ResolvedRefs
79+
status: "True"
80+
type: ResolvedRefs
81+
controllerName: gateway.envoyproxy.io/gatewayclass-controller
82+
parentRef:
83+
name: gateway-1
84+
namespace: envoy-gateway
85+
sectionName: http
86+
infraIR:
87+
envoy-gateway/gateway-1:
88+
proxy:
89+
listeners:
90+
- address: null
91+
name: envoy-gateway/gateway-1/http
92+
ports:
93+
- containerPort: 10080
94+
name: http-80
95+
protocol: HTTP
96+
servicePort: 80
97+
metadata:
98+
labels:
99+
gateway.envoyproxy.io/owning-gateway-name: gateway-1
100+
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway
101+
ownerReference:
102+
kind: GatewayClass
103+
name: envoy-gateway-class
104+
name: envoy-gateway/gateway-1
105+
namespace: ""
106+
xdsIR:
107+
envoy-gateway/gateway-1:
108+
accessLog:
109+
json:
110+
- path: /dev/stdout
111+
globalResources:
112+
proxyServiceCluster:
113+
name: envoy-gateway/gateway-1
114+
settings:
115+
- addressType: IP
116+
endpoints:
117+
- host: 7.6.5.4
118+
port: 8080
119+
zone: zone1
120+
metadata:
121+
name: envoy-envoy-gateway-gateway-1-196ae069
122+
sectionName: "8080"
123+
name: envoy-gateway/gateway-1
124+
protocol: TCP
125+
http:
126+
- address: 0.0.0.0
127+
externalPort: 80
128+
hostnames:
129+
- '*'
130+
isHTTP2: true
131+
metadata:
132+
kind: Gateway
133+
name: gateway-1
134+
namespace: envoy-gateway
135+
sectionName: http
136+
name: envoy-gateway/gateway-1/http
137+
path:
138+
escapedSlashesAction: UnescapeAndRedirect
139+
mergeSlashes: true
140+
port: 10080
141+
routes:
142+
- destination:
143+
metadata:
144+
kind: GRPCRoute
145+
name: grpcroute-1
146+
namespace: default
147+
name: grpcroute/default/grpcroute-1/rule/0
148+
settings:
149+
- addressType: IP
150+
endpoints:
151+
- host: 7.7.7.7
152+
port: 8080
153+
metadata:
154+
name: service-1
155+
namespace: default
156+
sectionName: "8080"
157+
name: grpcroute/default/grpcroute-1/rule/0/backend/0
158+
protocol: GRPC
159+
weight: 1
160+
extensionRefs:
161+
- object:
162+
apiVersion: foo.example.io/v1alpha1
163+
kind: Foo
164+
metadata:
165+
name: test
166+
namespace: default
167+
spec:
168+
data: stuff
169+
hostname: '*'
170+
isHTTP2: true
171+
metadata:
172+
kind: GRPCRoute
173+
name: grpcroute-1
174+
namespace: default
175+
name: grpcroute/default/grpcroute-1/rule/0/match/0/*
176+
pathMatch:
177+
distinct: false
178+
name: ""
179+
prefix: /com.example.Service
180+
readyListener:
181+
address: 0.0.0.0
182+
ipFamily: IPv4
183+
path: /ready
184+
port: 19003

0 commit comments

Comments
 (0)