Skip to content

Commit 7cc1b6e

Browse files
committed
move EnvoyPorxy validation out of Provider
Signed-off-by: zirain <[email protected]>
1 parent 58eab94 commit 7cc1b6e

16 files changed

+331
-600
lines changed

api/v1alpha1/validation/envoyproxy_validate.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,7 @@ func validateProxyAccessLog(accessLog *egv1a1.ProxyAccessLog) []error {
238238
errs = append(errs, err)
239239
}
240240
case egv1a1.ProxyAccessLogFormatTypeJSON:
241-
if setting.Format.JSON == nil {
242-
err := fmt.Errorf("unable to configure access log when using JSON format but \"json\" field being empty")
243-
errs = append(errs, err)
244-
}
241+
// TODO: add JSON format validation if needed
245242
}
246243
}
247244

internal/cmd/egctl/testdata/translate/out/invalid-envoyproxy.all.yaml

Lines changed: 0 additions & 362 deletions
Original file line numberDiff line numberDiff line change
@@ -43,365 +43,3 @@ gatewayClass:
4343
reason: InvalidParameters
4444
status: "False"
4545
type: Accepted
46-
gateways:
47-
- apiVersion: gateway.networking.k8s.io/v1
48-
kind: Gateway
49-
metadata:
50-
creationTimestamp: null
51-
name: eg
52-
namespace: default
53-
spec:
54-
gatewayClassName: eg
55-
listeners:
56-
- allowedRoutes:
57-
namespaces:
58-
from: Same
59-
name: tcp
60-
port: 1234
61-
protocol: TCP
62-
- allowedRoutes:
63-
namespaces:
64-
from: Same
65-
name: udp
66-
port: 1234
67-
protocol: UDP
68-
- allowedRoutes:
69-
namespaces:
70-
from: Same
71-
hostname: foo.com
72-
name: tls-passthrough
73-
port: 8443
74-
protocol: TLS
75-
tls:
76-
mode: Passthrough
77-
- allowedRoutes:
78-
kinds:
79-
- group: gateway.networking.k8s.io
80-
kind: HTTPRoute
81-
namespaces:
82-
from: Same
83-
name: http
84-
port: 80
85-
protocol: HTTP
86-
- allowedRoutes:
87-
kinds:
88-
- group: gateway.networking.k8s.io
89-
kind: GRPCRoute
90-
namespaces:
91-
from: Same
92-
name: grpc
93-
port: 8080
94-
protocol: HTTP
95-
status:
96-
listeners:
97-
- attachedRoutes: 1
98-
conditions:
99-
- lastTransitionTime: null
100-
message: Sending translated listener configuration to the data plane
101-
reason: Programmed
102-
status: "True"
103-
type: Programmed
104-
- lastTransitionTime: null
105-
message: Listener has been successfully translated
106-
reason: Accepted
107-
status: "True"
108-
type: Accepted
109-
- lastTransitionTime: null
110-
message: Listener references have been resolved
111-
reason: ResolvedRefs
112-
status: "True"
113-
type: ResolvedRefs
114-
name: tcp
115-
supportedKinds:
116-
- group: gateway.networking.k8s.io
117-
kind: TCPRoute
118-
- attachedRoutes: 1
119-
conditions:
120-
- lastTransitionTime: null
121-
message: Sending translated listener configuration to the data plane
122-
reason: Programmed
123-
status: "True"
124-
type: Programmed
125-
- lastTransitionTime: null
126-
message: Listener has been successfully translated
127-
reason: Accepted
128-
status: "True"
129-
type: Accepted
130-
- lastTransitionTime: null
131-
message: Listener references have been resolved
132-
reason: ResolvedRefs
133-
status: "True"
134-
type: ResolvedRefs
135-
name: udp
136-
supportedKinds:
137-
- group: gateway.networking.k8s.io
138-
kind: UDPRoute
139-
- attachedRoutes: 1
140-
conditions:
141-
- lastTransitionTime: null
142-
message: Sending translated listener configuration to the data plane
143-
reason: Programmed
144-
status: "True"
145-
type: Programmed
146-
- lastTransitionTime: null
147-
message: Listener has been successfully translated
148-
reason: Accepted
149-
status: "True"
150-
type: Accepted
151-
- lastTransitionTime: null
152-
message: Listener references have been resolved
153-
reason: ResolvedRefs
154-
status: "True"
155-
type: ResolvedRefs
156-
name: tls-passthrough
157-
supportedKinds:
158-
- group: gateway.networking.k8s.io
159-
kind: TLSRoute
160-
- attachedRoutes: 1
161-
conditions:
162-
- lastTransitionTime: null
163-
message: Sending translated listener configuration to the data plane
164-
reason: Programmed
165-
status: "True"
166-
type: Programmed
167-
- lastTransitionTime: null
168-
message: Listener has been successfully translated
169-
reason: Accepted
170-
status: "True"
171-
type: Accepted
172-
- lastTransitionTime: null
173-
message: Listener references have been resolved
174-
reason: ResolvedRefs
175-
status: "True"
176-
type: ResolvedRefs
177-
name: http
178-
supportedKinds:
179-
- group: gateway.networking.k8s.io
180-
kind: HTTPRoute
181-
- attachedRoutes: 1
182-
conditions:
183-
- lastTransitionTime: null
184-
message: Sending translated listener configuration to the data plane
185-
reason: Programmed
186-
status: "True"
187-
type: Programmed
188-
- lastTransitionTime: null
189-
message: Listener has been successfully translated
190-
reason: Accepted
191-
status: "True"
192-
type: Accepted
193-
- lastTransitionTime: null
194-
message: Listener references have been resolved
195-
reason: ResolvedRefs
196-
status: "True"
197-
type: ResolvedRefs
198-
name: grpc
199-
supportedKinds:
200-
- group: gateway.networking.k8s.io
201-
kind: GRPCRoute
202-
grpcRoutes:
203-
- apiVersion: gateway.networking.k8s.io/v1
204-
kind: GRPCRoute
205-
metadata:
206-
creationTimestamp: null
207-
name: backend
208-
namespace: default
209-
spec:
210-
hostnames:
211-
- www.grpc-example.com
212-
parentRefs:
213-
- group: gateway.networking.k8s.io
214-
kind: Gateway
215-
name: eg
216-
sectionName: grpc
217-
rules:
218-
- backendRefs:
219-
- group: ""
220-
kind: Service
221-
name: backend
222-
port: 9000
223-
weight: 1
224-
matches:
225-
- method:
226-
method: DoThing
227-
service: com.example.Things
228-
type: Exact
229-
status:
230-
parents:
231-
- conditions:
232-
- lastTransitionTime: null
233-
message: Route is accepted
234-
reason: Accepted
235-
status: "True"
236-
type: Accepted
237-
- lastTransitionTime: null
238-
message: Resolved all the Object references for the Route
239-
reason: ResolvedRefs
240-
status: "True"
241-
type: ResolvedRefs
242-
controllerName: gateway.envoyproxy.io/gatewayclass-controller
243-
parentRef:
244-
group: gateway.networking.k8s.io
245-
kind: Gateway
246-
name: eg
247-
sectionName: grpc
248-
httpRoutes:
249-
- apiVersion: gateway.networking.k8s.io/v1
250-
kind: HTTPRoute
251-
metadata:
252-
creationTimestamp: null
253-
name: backend
254-
namespace: default
255-
spec:
256-
hostnames:
257-
- www.example.com
258-
parentRefs:
259-
- group: gateway.networking.k8s.io
260-
kind: Gateway
261-
name: eg
262-
rules:
263-
- backendRefs:
264-
- group: ""
265-
kind: Service
266-
name: backend
267-
port: 3000
268-
weight: 1
269-
matches:
270-
- path:
271-
type: PathPrefix
272-
value: /
273-
status:
274-
parents:
275-
- conditions:
276-
- lastTransitionTime: null
277-
message: Route is accepted
278-
reason: Accepted
279-
status: "True"
280-
type: Accepted
281-
- lastTransitionTime: null
282-
message: Resolved all the Object references for the Route
283-
reason: ResolvedRefs
284-
status: "True"
285-
type: ResolvedRefs
286-
controllerName: gateway.envoyproxy.io/gatewayclass-controller
287-
parentRef:
288-
group: gateway.networking.k8s.io
289-
kind: Gateway
290-
name: eg
291-
tcpRoutes:
292-
- apiVersion: gateway.networking.k8s.io/v1alpha2
293-
kind: TCPRoute
294-
metadata:
295-
creationTimestamp: null
296-
name: backend
297-
namespace: default
298-
spec:
299-
parentRefs:
300-
- group: gateway.networking.k8s.io
301-
kind: Gateway
302-
name: eg
303-
sectionName: tcp
304-
rules:
305-
- backendRefs:
306-
- group: ""
307-
kind: Service
308-
name: backend
309-
port: 3000
310-
weight: 1
311-
status:
312-
parents:
313-
- conditions:
314-
- lastTransitionTime: null
315-
message: Route is accepted
316-
reason: Accepted
317-
status: "True"
318-
type: Accepted
319-
- lastTransitionTime: null
320-
message: Resolved all the Object references for the Route
321-
reason: ResolvedRefs
322-
status: "True"
323-
type: ResolvedRefs
324-
controllerName: gateway.envoyproxy.io/gatewayclass-controller
325-
parentRef:
326-
group: gateway.networking.k8s.io
327-
kind: Gateway
328-
name: eg
329-
sectionName: tcp
330-
tlsRoutes:
331-
- apiVersion: gateway.networking.k8s.io/v1alpha2
332-
kind: TLSRoute
333-
metadata:
334-
creationTimestamp: null
335-
name: backend
336-
namespace: default
337-
spec:
338-
parentRefs:
339-
- group: gateway.networking.k8s.io
340-
kind: Gateway
341-
name: eg
342-
sectionName: tls-passthrough
343-
rules:
344-
- backendRefs:
345-
- group: ""
346-
kind: Service
347-
name: backend
348-
port: 3000
349-
weight: 1
350-
status:
351-
parents:
352-
- conditions:
353-
- lastTransitionTime: null
354-
message: Route is accepted
355-
reason: Accepted
356-
status: "True"
357-
type: Accepted
358-
- lastTransitionTime: null
359-
message: Resolved all the Object references for the Route
360-
reason: ResolvedRefs
361-
status: "True"
362-
type: ResolvedRefs
363-
controllerName: gateway.envoyproxy.io/gatewayclass-controller
364-
parentRef:
365-
group: gateway.networking.k8s.io
366-
kind: Gateway
367-
name: eg
368-
sectionName: tls-passthrough
369-
udpRoutes:
370-
- apiVersion: gateway.networking.k8s.io/v1alpha2
371-
kind: UDPRoute
372-
metadata:
373-
creationTimestamp: null
374-
name: backend
375-
namespace: default
376-
spec:
377-
parentRefs:
378-
- group: gateway.networking.k8s.io
379-
kind: Gateway
380-
name: eg
381-
sectionName: udp
382-
rules:
383-
- backendRefs:
384-
- group: ""
385-
kind: Service
386-
name: backend
387-
port: 3000
388-
weight: 1
389-
status:
390-
parents:
391-
- conditions:
392-
- lastTransitionTime: null
393-
message: Route is accepted
394-
reason: Accepted
395-
status: "True"
396-
type: Accepted
397-
- lastTransitionTime: null
398-
message: Resolved all the Object references for the Route
399-
reason: ResolvedRefs
400-
status: "True"
401-
type: ResolvedRefs
402-
controllerName: gateway.envoyproxy.io/gatewayclass-controller
403-
parentRef:
404-
group: gateway.networking.k8s.io
405-
kind: Gateway
406-
name: eg
407-
sectionName: udp

internal/cmd/egctl/testdata/translate/out/quickstart.all.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
gatewayClass:
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: GatewayClass
4+
metadata:
5+
creationTimestamp: null
6+
name: eg
7+
spec:
8+
controllerName: gateway.envoyproxy.io/gatewayclass-controller
9+
status: {}
110
gateways:
211
- apiVersion: gateway.networking.k8s.io/v1
312
kind: Gateway

0 commit comments

Comments
 (0)