Skip to content

Commit 4543c37

Browse files
kkk777-7zirain
authored andcommitted
feat: support ir metadata to tcproute/udproute
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
1 parent cab067a commit 4543c37

File tree

52 files changed

+326
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+326
-4
lines changed

internal/gatewayapi/listener.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
151151
Address: address,
152152
Port: uint32(containerPort),
153153
ExternalPort: uint32(listener.Port),
154+
Metadata: buildListenerMetadata(listener, gateway),
154155
IPFamily: ipFamily,
155156
},
156157

@@ -168,6 +169,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
168169
Address: address,
169170
Port: uint32(containerPort),
170171
ExternalPort: uint32(listener.Port),
172+
Metadata: buildListenerMetadata(listener, gateway),
171173
},
172174
}
173175
xdsIR[irKey].UDP = append(xdsIR[irKey].UDP, irListener)

internal/gatewayapi/route.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,8 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour
11631163
Destination: &ir.RouteDestination{
11641164
Name: destName,
11651165
Settings: destSettings,
1166-
Metadata: buildResourceMetadata(udpRoute, nil),
1166+
// udpRoute Must have a single rule, so can use index 0.
1167+
Metadata: buildResourceMetadata(udpRoute, udpRoute.Spec.Rules[0].Name),
11671168
},
11681169
}
11691170
irListener.Route = irRoute
@@ -1310,7 +1311,8 @@ func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resour
13101311
Destination: &ir.RouteDestination{
13111312
Name: destName,
13121313
Settings: destSettings,
1313-
Metadata: buildResourceMetadata(tcpRoute, nil),
1314+
// tcpRoute Must have a single rule, so can use index 0.
1315+
Metadata: buildResourceMetadata(tcpRoute, tcpRoute.Spec.Rules[0].Name),
13141316
},
13151317
}
13161318

internal/gatewayapi/testdata/backendtrafficpolicy-status-conditions.out.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,5 +680,10 @@ xdsIR:
680680
tcp:
681681
- address: 0.0.0.0
682682
externalPort: 53
683+
metadata:
684+
kind: Gateway
685+
name: gateway-2
686+
namespace: envoy-gateway
687+
sectionName: tcp
683688
name: envoy-gateway/gateway-2/tcp
684689
port: 10053

internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-gateway.out.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ xdsIR:
259259
tcp:
260260
- address: 0.0.0.0
261261
externalPort: 8089
262+
metadata:
263+
kind: Gateway
264+
name: tcp-gateway
265+
namespace: default
266+
sectionName: bar
262267
name: default/tcp-gateway/bar
263268
port: 8089
264269
routes:
@@ -328,6 +333,11 @@ xdsIR:
328333
udp:
329334
- address: 0.0.0.0
330335
externalPort: 8162
336+
metadata:
337+
kind: Gateway
338+
name: tcp-gateway
339+
namespace: default
340+
sectionName: foo
331341
name: default/tcp-gateway/foo
332342
port: 8162
333343
route:

internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-route.out.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ xdsIR:
332332
tcp:
333333
- address: 0.0.0.0
334334
externalPort: 8089
335+
metadata:
336+
kind: Gateway
337+
name: tcp-gateway
338+
namespace: default
339+
sectionName: bar
335340
name: default/tcp-gateway/bar
336341
port: 8089
337342
routes:
@@ -401,6 +406,11 @@ xdsIR:
401406
udp:
402407
- address: 0.0.0.0
403408
externalPort: 8162
409+
metadata:
410+
kind: Gateway
411+
name: tcp-gateway
412+
namespace: default
413+
sectionName: foo
404414
name: default/tcp-gateway/foo
405415
port: 8162
406416
route:

internal/gatewayapi/testdata/clienttrafficpolicy-for-tcp-listeners.out.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ xdsIR:
216216
closeDelay: 10s
217217
value: 3
218218
externalPort: 443
219+
metadata:
220+
kind: Gateway
221+
name: gateway-1
222+
namespace: envoy-gateway
223+
sectionName: tls-1
219224
name: envoy-gateway/gateway-1/tls-1
220225
port: 10443
221226
proxyProtocol: {}
@@ -288,6 +293,11 @@ xdsIR:
288293
closeDelay: 10s
289294
value: 3
290295
externalPort: 8080
296+
metadata:
297+
kind: Gateway
298+
name: gateway-1
299+
namespace: envoy-gateway
300+
sectionName: tcp-1
291301
name: envoy-gateway/gateway-1/tcp-1
292302
port: 8080
293303
proxyProtocol: {}

internal/gatewayapi/testdata/clienttrafficpolicy-invalid-settings.out.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,11 @@ xdsIR:
957957
tcp:
958958
- address: 0.0.0.0
959959
externalPort: 8443
960+
metadata:
961+
kind: Gateway
962+
name: gateway-1
963+
namespace: default
964+
sectionName: tcp-1
960965
name: default/gateway-1/tcp-1
961966
port: 8443
962967
tls:
@@ -969,6 +974,11 @@ xdsIR:
969974
minVersion: "1.2"
970975
- address: 0.0.0.0
971976
externalPort: 5000
977+
metadata:
978+
kind: Gateway
979+
name: gateway-1
980+
namespace: default
981+
sectionName: tcp-2
972982
name: default/gateway-1/tcp-2
973983
port: 5000
974984
routes:
@@ -1050,6 +1060,11 @@ xdsIR:
10501060
tcp:
10511061
- address: 0.0.0.0
10521062
externalPort: 8443
1063+
metadata:
1064+
kind: Gateway
1065+
name: gateway-2
1066+
namespace: default
1067+
sectionName: tcp-1
10531068
name: default/gateway-2/tcp-1
10541069
port: 8443
10551070
tls:
@@ -1062,6 +1077,11 @@ xdsIR:
10621077
minVersion: "1.2"
10631078
- address: 0.0.0.0
10641079
externalPort: 5000
1080+
metadata:
1081+
kind: Gateway
1082+
name: gateway-2
1083+
namespace: default
1084+
sectionName: tcp-2
10651085
name: default/gateway-2/tcp-2
10661086
port: 5000
10671087
default/gateway-3:
@@ -1133,6 +1153,11 @@ xdsIR:
11331153
tcp:
11341154
- address: 0.0.0.0
11351155
externalPort: 8443
1156+
metadata:
1157+
kind: Gateway
1158+
name: gateway-3
1159+
namespace: default
1160+
sectionName: tcp-1
11361161
name: default/gateway-3/tcp-1
11371162
port: 8443
11381163
tls:
@@ -1145,5 +1170,10 @@ xdsIR:
11451170
minVersion: "1.2"
11461171
- address: 0.0.0.0
11471172
externalPort: 5000
1173+
metadata:
1174+
kind: Gateway
1175+
name: gateway-3
1176+
namespace: default
1177+
sectionName: tcp-2
11481178
name: default/gateway-3/tcp-2
11491179
port: 5000

internal/gatewayapi/testdata/clienttrafficpolicy-mtls-client-verification.out.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,11 @@ xdsIR:
640640
tcp:
641641
- address: 0.0.0.0
642642
externalPort: 6443
643+
metadata:
644+
kind: Gateway
645+
name: gateway-3
646+
namespace: envoy-gateway
647+
sectionName: tls-1
643648
name: envoy-gateway/gateway-3/tls-1
644649
port: 6443
645650
routes:

internal/gatewayapi/testdata/clienttrafficpolicy-proxyprotocol-legacy-mixed.out.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ xdsIR:
300300
tcp:
301301
- address: 0.0.0.0
302302
externalPort: 9090
303+
metadata:
304+
kind: Gateway
305+
name: gateway-legacy-only
306+
namespace: envoy-gateway
307+
sectionName: tcp-1
303308
name: envoy-gateway/gateway-legacy-only/tcp-1
304309
port: 9090
305310
proxyProtocol: {}

internal/gatewayapi/testdata/clienttrafficpolicy-status-conditions.out.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,11 @@ xdsIR:
566566
tcp:
567567
- address: 0.0.0.0
568568
externalPort: 53
569+
metadata:
570+
kind: Gateway
571+
name: gateway-2
572+
namespace: envoy-gateway
573+
sectionName: tcp
569574
name: envoy-gateway/gateway-2/tcp
570575
port: 10053
571576
envoy-gateway/gateway-3:

0 commit comments

Comments
 (0)