Skip to content

Commit f99c36c

Browse files
authored
fix: tcp listener is rejected when no route attached (#4681)
* fix: tcp listener is rejected when no route attached Signed-off-by: Huabing Zhao <[email protected]> * change cluter name Signed-off-by: Huabing Zhao <[email protected]> * fix listener connection limit test Signed-off-by: Huabing Zhao <[email protected]> * fix listener connetcp keepalive test Signed-off-by: Huabing Zhao <[email protected]> * fix tcp endpoint stats test Signed-off-by: Huabing Zhao <[email protected]> * fix tcp-route-enable-req-resp-sizes-stats Signed-off-by: Huabing Zhao <[email protected]> * fix extensionpolicy-tcp-udp-http test Signed-off-by: Huabing Zhao <[email protected]> * fix lint Signed-off-by: Huabing Zhao <[email protected]> --------- Signed-off-by: Huabing Zhao <[email protected]>
1 parent 8a01dd6 commit f99c36c

28 files changed

+506
-54
lines changed

internal/xds/translator/testdata/in/extension-xds-ir/extensionpolicy-tcp-udp-http.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ http:
3535
escapedSlashesAction: UnescapeAndRedirect
3636
mergeSlashes: true
3737
port: 10080
38+
routes:
39+
- name: "http-route"
40+
hostname: "*"
41+
destination:
42+
name: "http-route-dest"
43+
settings:
44+
- endpoints:
45+
- host: "1.2.3.4"
46+
port: 50000
3847
tcp:
3948
- address: 0.0.0.0
4049
extensionRefs:
@@ -66,6 +75,13 @@ tcp:
6675
controllerName: gateway.envoyproxy.io/gatewayclass-controller
6776
name: envoy-gateway/gateway-1/tcp1
6877
port: 10080
78+
routes:
79+
- destination:
80+
name: "tcp-route-dest"
81+
settings:
82+
- endpoints:
83+
- host: "1.2.3.4"
84+
port: 50000
6985
udp:
7086
- address: 0.0.0.0
7187
route:

internal/xds/translator/testdata/in/xds-ir/listener-connection-limit.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,28 @@ tcp:
4444
connection:
4545
limit:
4646
value: 3
47-
tls:
48-
passthrough:
49-
snis:
50-
- bar.com
51-
destination:
52-
name: "tls-route-dest"
53-
settings:
54-
- endpoints:
55-
- host: "1.2.3.4"
56-
port: 50000
47+
routes:
48+
- tls:
49+
inspector:
50+
snis:
51+
- bar.com
52+
destination:
53+
name: "tls-route-dest"
54+
settings:
55+
- endpoints:
56+
- host: "1.2.3.4"
57+
port: 50000
5758
- name: "fourth-listener"
5859
address: "0.0.0.0"
5960
connection:
6061
limit:
6162
value: 10
6263
closeDelay: 3s
6364
port: 10083
64-
destination:
65-
name: "tcp-route-dest"
66-
settings:
67-
- endpoints:
68-
- host: "1.2.3.4"
69-
port: 50000
65+
routes:
66+
- destination:
67+
name: "tcp-route-dest"
68+
settings:
69+
- endpoints:
70+
- host: "1.2.3.4"
71+
port: 50000

internal/xds/translator/testdata/in/xds-ir/listener-tcp-keepalive.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,26 @@ tcp:
4343
address: "0.0.0.0"
4444
port: 10082
4545
tcpKeepalive: {}
46-
tls:
47-
inspector:
48-
snis:
49-
- bar.com
50-
destination:
51-
name: "tls-route-dest"
52-
settings:
53-
- endpoints:
54-
- host: "1.2.3.4"
55-
port: 50000
46+
routes:
47+
- tls:
48+
inspector:
49+
snis:
50+
- bar.com
51+
destination:
52+
name: "tls-route-dest"
53+
settings:
54+
- endpoints:
55+
- host: "1.2.3.4"
56+
port: 50000
5657
- name: "fourth-listener"
5758
address: "0.0.0.0"
5859
tcpKeepalive:
5960
probes: 10
6061
port: 10083
61-
destination:
62-
name: "tcp-route-dest"
63-
settings:
64-
- endpoints:
65-
- host: "1.2.3.4"
66-
port: 50000
62+
routes:
63+
- destination:
64+
name: "tcp-route-dest"
65+
settings:
66+
- endpoints:
67+
- host: "1.2.3.4"
68+
port: 50000
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tcp:
2+
- address: 0.0.0.0
3+
connection:
4+
bufferLimit: 50000000
5+
limit:
6+
closeDelay: 10s
7+
value: 3
8+
enableProxyProtocol: true
9+
name: envoy-gateway/gateway-1/tls-1
10+
port: 10443
11+
tcpKeepalive:
12+
idleTime: 1200
13+
interval: 60
14+
probes: 3
15+
timeout:
16+
tcp:
17+
idleTimeout: 20m0s

internal/xds/translator/testdata/in/xds-ir/tcp-endpoint-stats.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ tcp:
55
- name: "tcp-route-enable-endpoint-stats"
66
address: "0.0.0.0"
77
port: 10080
8-
destination:
9-
name: "tcp-route-simple-dest"
10-
settings:
11-
- endpoints:
12-
- host: "1.2.3.4"
13-
port: 50000
14-
- host: "5.6.7.8"
15-
port: 50001
8+
routes:
9+
- destination:
10+
name: "tcp-route-simple-dest"
11+
settings:
12+
- endpoints:
13+
- host: "1.2.3.4"
14+
port: 50000
15+
- host: "5.6.7.8"
16+
port: 50001

internal/xds/translator/testdata/in/xds-ir/tcp-req-resp-sizes-stats.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ tcp:
55
- name: "tcp-route-enable-req-resp-sizes-stats"
66
address: "0.0.0.0"
77
port: 10080
8-
destination:
9-
name: "tcp-route-simple-dest"
10-
settings:
11-
- endpoints:
12-
- host: "1.2.3.4"
13-
port: 50000
14-
- host: "5.6.7.8"
15-
port: 50001
8+
routes:
9+
- destination:
10+
name: "tcp-route-simple-dest"
11+
settings:
12+
- endpoints:
13+
- host: "1.2.3.4"
14+
port: 50000
15+
- host: "5.6.7.8"
16+
port: 50001

internal/xds/translator/testdata/out/extension-xds-ir/extensionpolicy-tcp-udp-http.clusters.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
- circuitBreakers:
2+
thresholds:
3+
- maxRetries: 1024
4+
commonLbConfig:
5+
localityWeightedLbConfig: {}
6+
connectTimeout: 10s
7+
dnsLookupFamily: V4_ONLY
8+
edsClusterConfig:
9+
edsConfig:
10+
ads: {}
11+
resourceApiVersion: V3
12+
serviceName: http-route-dest
13+
ignoreHealthOnHostRemoval: true
14+
lbPolicy: LEAST_REQUEST
15+
name: http-route-dest
16+
outlierDetection: {}
17+
perConnectionBufferLimitBytes: 32768
18+
type: EDS
19+
- circuitBreakers:
20+
thresholds:
21+
- maxRetries: 1024
22+
commonLbConfig:
23+
localityWeightedLbConfig: {}
24+
connectTimeout: 10s
25+
dnsLookupFamily: V4_ONLY
26+
edsClusterConfig:
27+
edsConfig:
28+
ads: {}
29+
resourceApiVersion: V3
30+
serviceName: tcp-route-dest
31+
ignoreHealthOnHostRemoval: true
32+
lbPolicy: LEAST_REQUEST
33+
name: tcp-route-dest
34+
outlierDetection: {}
35+
perConnectionBufferLimitBytes: 32768
36+
type: EDS
137
- circuitBreakers:
238
thresholds:
339
- maxRetries: 1024

internal/xds/translator/testdata/out/extension-xds-ir/extensionpolicy-tcp-udp-http.endpoints.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
- clusterName: http-route-dest
2+
endpoints:
3+
- lbEndpoints:
4+
- endpoint:
5+
address:
6+
socketAddress:
7+
address: 1.2.3.4
8+
portValue: 50000
9+
loadBalancingWeight: 1
10+
loadBalancingWeight: 1
11+
locality:
12+
region: http-route-dest/backend/0
13+
- clusterName: tcp-route-dest
14+
endpoints:
15+
- lbEndpoints:
16+
- endpoint:
17+
address:
18+
socketAddress:
19+
address: 1.2.3.4
20+
portValue: 50000
21+
loadBalancingWeight: 1
22+
loadBalancingWeight: 1
23+
locality:
24+
region: tcp-route-dest/backend/0
125
- clusterName: udp-route-dest
226
endpoints:
327
- lbEndpoints:

internal/xds/translator/testdata/out/extension-xds-ir/extensionpolicy-tcp-udp-http.listeners.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
statPrefix: http-10080
3131
useRemoteAddress: true
3232
name: envoy-gateway/gateway-1/http1
33+
filterChains:
34+
- filters:
35+
- name: envoy.filters.network.tcp_proxy
36+
typedConfig:
37+
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
38+
cluster: tcp-route-dest
39+
statPrefix: tcp-10080
3340
name: envoy-gateway/gateway-1/http1
3441
perConnectionBufferLimitBytes: 32768
3542
statPrefix: envoy-gateway/gateway-1/http1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
- ignorePortInHostMatching: true
22
name: envoy-gateway/gateway-1/http1
3+
virtualHosts:
4+
- domains:
5+
- '*'
6+
name: envoy-gateway/gateway-1/http1/*
7+
routes:
8+
- match:
9+
prefix: /
10+
name: http-route
11+
route:
12+
cluster: http-route-dest
13+
upgradeConfigs:
14+
- upgradeType: websocket

0 commit comments

Comments
 (0)