Skip to content

Commit 9f553dc

Browse files
committed
MINOR: improve backend naming
to have more clear separation between service name and ingress data, more clear `_svc_` separator was added
1 parent f8ed716 commit 9f553dc

21 files changed

+224
-74
lines changed

.aspell.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ allowed:
6060
- SNI
6161
- gwapi
6262
- init
63+
- svc

deploy/tests/e2e/cookie-persistence/cookie-persistence_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestCookiePersistenceTestSuite(t *testing.T) {
3838
}
3939

4040
// Expected backend
41-
// backend e2e-tests-cookie-persistence_http-echo_http
41+
// backend e2e-tests-cookie-persistence_svc_http-echo_http
4242
// ...
4343
// cookie mycookie dynamic indirect nocache insert
4444
// dynamic-cookie-key ohph7OoGhong
@@ -84,7 +84,7 @@ func (suite *CookiePersistenceTestSuite) Test_CookiePersistence_Dynamic() {
8484
reader := strings.NewReader(cfg)
8585
p, err := parser.New(options.Reader(reader))
8686
suite.Require().NoError(err, "Could not get Haproxy config parser")
87-
beName := suite.test.GetNS() + "_http-echo_http"
87+
beName := suite.test.GetNS() + "_svc_http-echo_http"
8888
serverName := "SRV_1"
8989

9090
suite.checkServerNoCookie(p, beName, serverName)
@@ -122,7 +122,7 @@ func (suite *CookiePersistenceTestSuite) Test_CookiePersistence_Dynamic() {
122122
}
123123

124124
// Expected backend
125-
// backend e2e-tests-cookie-persistence_http-echo_http
125+
// backend e2e-tests-cookie-persistence_svc_http-echo_http
126126
// ...
127127
// cookie mycookie indirect nocache insert
128128
// server SRV_1 10.244.0.13:8888 enabled cookie SRV_1
@@ -166,7 +166,7 @@ func (suite *CookiePersistenceTestSuite) Test_CookiePersistence_No_Dynamic() {
166166
suite.Require().NoError(err, "Could not get Haproxy config parser")
167167

168168
// Check that the server line
169-
beName := suite.test.GetNS() + "_http-echo_http"
169+
beName := suite.test.GetNS() + "_svc_http-echo_http"
170170
serverName := "SRV_1"
171171

172172
suite.checkServerCookie(p, beName, serverName)
@@ -242,7 +242,7 @@ func (suite *CookiePersistenceTestSuite) Test_CookiePersistence_Switch() {
242242
reader := strings.NewReader(cfg)
243243
p, err := parser.New(options.Reader(reader))
244244
suite.Require().NoError(err, "Could not get Haproxy config parser")
245-
beName := suite.test.GetNS() + "_http-echo_http"
245+
beName := suite.test.GetNS() + "_svc_http-echo_http"
246246
serverName := "SRV_1"
247247

248248
suite.checkServerNoCookie(p, beName, serverName)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: ingress.v3.haproxy.org/v3
2+
kind: TCP
3+
metadata:
4+
annotations:
5+
ingress.class: haproxy
6+
creationTimestamp: null
7+
name: tcp-1
8+
spec:
9+
- frontend:
10+
acl_list:
11+
- acl_name: switch_be_0
12+
criterion: req_ssl_sni
13+
value: -i backend0.example.com
14+
- acl_name: switch_be_1
15+
criterion: req_ssl_sni
16+
value: -i backend1.example.com
17+
backend_switching_rule_list:
18+
- cond: if
19+
cond_test: switch_be_0
20+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
21+
- cond: if
22+
cond_test: switch_be_1
23+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
24+
binds:
25+
v4:
26+
address: 0.0.0.0
27+
name: v4
28+
port: 32766
29+
log_format: "%{+Q}o %t %s"
30+
name: fe-http-echo
31+
tcp_request_rule_list:
32+
- timeout: 5000
33+
type: inspect-delay
34+
- action: accept
35+
cond: if
36+
cond_test: "{ req_ssl_hello_type 1 }"
37+
type: content
38+
tcplog: true
39+
name: tcp-test
40+
service:
41+
name: http-echo
42+
port: 443
43+
services:
44+
- name: http-echo-0
45+
port: 443
46+
- name: http-echo-1
47+
port: 443
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: ingress.v3.haproxy.org/v3
2+
kind: TCP
3+
metadata:
4+
annotations:
5+
ingress.class: haproxy
6+
creationTimestamp: null
7+
name: tcp-1
8+
spec:
9+
- frontend:
10+
backend_switching_rule_list:
11+
- cond: if
12+
cond_test: "{ req_ssl_sni -i backend0.example.com }"
13+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
14+
- cond: if
15+
cond_test: "{ req_ssl_sni -i backend1.example.com }"
16+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
17+
binds:
18+
v4:
19+
address: 0.0.0.0
20+
name: v4
21+
port: 32766
22+
log_format: "%{+Q}o %t %s"
23+
name: fe-http-echo
24+
tcp_request_rule_list:
25+
- timeout: 5000
26+
type: inspect-delay
27+
- action: accept
28+
cond: if
29+
cond_test: "{ req_ssl_hello_type 1 }"
30+
type: content
31+
tcplog: true
32+
name: tcp-test
33+
service:
34+
name: http-echo
35+
port: 443
36+
services:
37+
- name: http-echo-0
38+
port: 443
39+
- name: http-echo-1
40+
port: 443
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: ingress.v3.haproxy.org/v3
2+
kind: TCP
3+
metadata:
4+
annotations:
5+
ingress.class: haproxy
6+
creationTimestamp: null
7+
name: tcp-1
8+
spec:
9+
- frontend:
10+
acl_list:
11+
- acl_name: switch_be_0
12+
criterion: req_ssl_sni
13+
value: -i backend0.example.com
14+
- acl_name: switch_be_1
15+
criterion: req_ssl_sni
16+
value: -i backend1.example.com
17+
backend_switching_rule_list:
18+
- cond: if
19+
cond_test: switch_be_0
20+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
21+
- cond: if
22+
cond_test: switch_be_1
23+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
24+
binds:
25+
v4:
26+
address: 0.0.0.0
27+
name: v4
28+
port: 32766
29+
capture_list:
30+
- length: 12345
31+
type: request
32+
- length: 54321
33+
type: response
34+
filter_list:
35+
- trace_name: BEFORE-HTTP-COMP
36+
type: trace
37+
- type: compression
38+
- trace_name: AFTER-HTTP-COMP
39+
type: trace
40+
log_format: "%{+Q}o %t %s"
41+
log_target_list:
42+
- address: stdout
43+
facility: daemon
44+
format: raw
45+
name: fe-http-echo
46+
tcp_request_rule_list:
47+
- timeout: 5000
48+
type: inspect-delay
49+
- action: accept
50+
cond: if
51+
cond_test: "{ req_ssl_hello_type 1 }"
52+
type: content
53+
tcplog: true
54+
name: tcp-test
55+
service:
56+
name: http-echo
57+
port: 443
58+
services:
59+
- name: http-echo-0
60+
port: 443
61+
- name: http-echo-1
62+
port: 443

deploy/tests/e2e/crd-tcp/config/tcp-cr-backend-switching-rule-acls.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ spec:
2525
value: -i backend1.example.com
2626
backend_switching_rule_list:
2727
- cond: if
28-
cond_test: 'switch_be_0'
28+
cond_test: "switch_be_0"
2929
index: 0
30-
name: e2e-tests-crd-tcp_http-echo-0_https
30+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
3131
- cond: if
32-
cond_test: 'switch_be_1'
32+
cond_test: "switch_be_1"
3333
index: 1
34-
name: e2e-tests-crd-tcp_http-echo-1_https
34+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
3535
tcp_request_rule_list:
3636
- type: inspect-delay
3737
timeout: 5000

deploy/tests/e2e/crd-tcp/config/tcp-cr-backend-switching-rule.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ spec:
1616
port: 32766
1717
backend_switching_rule_list:
1818
- cond: if
19-
cond_test: '{ req_ssl_sni -i backend0.example.com }'
19+
cond_test: "{ req_ssl_sni -i backend0.example.com }"
2020
index: 0
21-
name: e2e-tests-crd-tcp_http-echo-0_https
21+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
2222
- cond: if
23-
cond_test: '{ req_ssl_sni -i backend1.example.com }'
23+
cond_test: "{ req_ssl_sni -i backend1.example.com }"
2424
index: 1
25-
name: e2e-tests-crd-tcp_http-echo-1_https
25+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
2626
tcp_request_rule_list:
2727
- type: inspect-delay
2828
timeout: 5000

deploy/tests/e2e/crd-tcp/config/tcp-cr-full.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ spec:
2525
value: -i backend1.example.com
2626
backend_switching_rule_list:
2727
- cond: if
28-
cond_test: 'switch_be_0'
28+
cond_test: "switch_be_0"
2929
index: 0
30-
name: e2e-tests-crd-tcp_http-echo-0_https
30+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
3131
- cond: if
32-
cond_test: 'switch_be_1'
32+
cond_test: "switch_be_1"
3333
index: 1
34-
name: e2e-tests-crd-tcp_http-echo-1_https
34+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
3535
capture_list:
3636
- index: 0
3737
type: request

deploy/tests/e2e/crd-tcp/cr_tcp_additional_services_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestTCPSuiteAddtionalServices(t *testing.T) {
4444
// log-format '%{+Q}o %t %s'
4545
// option tcplog
4646
// default_backend e2e-tests-crd-tcp_http-echo_http
47-
// backend e2e-tests-crd-tcp_http-echo-2_http ## from service/http-echo-2 (port 80)
47+
// backend e2e-tests-crd-tcp_svc_http-echo-2_http ## from service/http-echo-2 (port 80)
4848
// mode tcp
4949
// balance roundrobin
5050
// no option abortonclose
@@ -54,7 +54,7 @@ func TestTCPSuiteAddtionalServices(t *testing.T) {
5454
// server SRV_2 [fd00:10:244::8]:8888 enabled
5555
// server SRV_3 127.0.0.1:8888 disabled
5656
// server SRV_4 127.0.0.1:8888 disabled
57-
// backend e2e-tests-crd-tcp_http-echo-2_https ## from service/http-echo-2 (port 443)
57+
// backend e2e-tests-crd-tcp_svc_http-echo-2_https ## from service/http-echo-2 (port 443)
5858
// mode tcp
5959
// balance roundrobin
6060
// no option abortonclose
@@ -64,7 +64,7 @@ func TestTCPSuiteAddtionalServices(t *testing.T) {
6464
// server SRV_2 [fd00:10:244::8]:8443 enabled
6565
// server SRV_3 127.0.0.1:8443 disabled
6666
// server SRV_4 127.0.0.1:8443 disabled
67-
// backend e2e-tests-crd-tcp_http-echo_http ## from service/http-echo (port 80)
67+
// backend e2e-tests-crd-tcp_svc_http-echo_http ## from service/http-echo (port 80)
6868
// mode tcp
6969
// balance roundrobin
7070
// no option abortonclose
@@ -99,22 +99,22 @@ func (suite *TCPSuiteAddtionalServices) Test_CRD_TCP_Additional_Services() {
9999
suite.checkFrontends(p)
100100

101101
// Checks for backend
102-
// BE: e2e-tests-crd-tcp_http-echo_http
102+
// BE: e2e-tests-crd-tcp_svc_http-echo_http
103103
// comes from TCP CR
104104
// service:
105105
// name: "http-echo"
106106
// port: 80
107-
// BE e2e-tests-crd-tcp_http-echo-2_http
107+
// BE e2e-tests-crd-tcp_svc_http-echo-2_http
108108
// comes from TCP CR
109109
// services:
110110
// - name: "http-echo-2"
111111
// port: 80
112-
// BE e2e-tests-crd-tcp_http-echo-2_https"
112+
// BE e2e-tests-crd-tcp_svc_http-echo-2_https"
113113
// comes from TCP CR
114114
// services:
115115
// - name: "http-echo-2"
116116
// port: 443
117-
beNames := []string{"e2e-tests-crd-tcp_http-echo_http", "e2e-tests-crd-tcp_http-echo-2_http", "e2e-tests-crd-tcp_http-echo-2_https"}
117+
beNames := []string{"e2e-tests-crd-tcp_svc_http-echo_http", "e2e-tests-crd-tcp_svc_http-echo-2_http", "e2e-tests-crd-tcp_svc_http-echo-2_https"}
118118
for _, beName := range beNames {
119119
suite.checkBackend(p, beName, "mode", &types.StringC{Value: "tcp"})
120120
suite.checkBackend(p, beName, "balance", &types.Balance{
@@ -162,5 +162,5 @@ func (suite *TCPSuiteAddtionalServices) checkFrontends(p parser.Parser) {
162162
suite.checkFrontend(p, feName, "mode", &types.StringC{Value: "tcp"})
163163
suite.checkFrontend(p, feName, "log-format", &types.StringC{Value: "'%{+Q}o %t %s'"})
164164
suite.checkFrontend(p, feName, "option tcplog", &types.SimpleOption{NoOption: false, Comment: ""})
165-
suite.checkFrontend(p, feName, "default_backend", &types.StringC{Value: "e2e-tests-crd-tcp_http-echo_http"})
165+
suite.checkFrontend(p, feName, "default_backend", &types.StringC{Value: "e2e-tests-crd-tcp_svc_http-echo_http"})
166166
}

deploy/tests/e2e/crd-tcp/cr_tcp_backend_switching_rule_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestTCPSuiteBackendSwitchingRule(t *testing.T) {
5050
// use_backend e2e-tests-crd-tcp_http-echo-1_https if { req_ssl_sni -i backend1.example.com }
5151
// default_backend e2e-tests-crd-tcp_http-echo_https
5252

53-
// backend e2e-tests-crd-tcp_http-echo-0_https
53+
// backend e2e-tests-crd-tcp_svc_http-echo-0_https
5454
// mode tcp
5555
// balance roundrobin
5656
// no option abortonclose
@@ -61,7 +61,7 @@ func TestTCPSuiteBackendSwitchingRule(t *testing.T) {
6161
// server SRV_3 127.0.0.1:8443 disabled
6262
// server SRV_4 127.0.0.1:8443 disabled
6363

64-
// backend e2e-tests-crd-tcp_http-echo-1_https
64+
// backend e2e-tests-crd-tcp_svc_http-echo-1_https
6565
// mode tcp
6666
// balance roundrobin
6767
// no option abortonclose
@@ -72,7 +72,7 @@ func TestTCPSuiteBackendSwitchingRule(t *testing.T) {
7272
// server SRV_3 127.0.0.1:8443 disabled
7373
// server SRV_4 127.0.0.1:8443 disabled
7474

75-
// backend e2e-tests-crd-tcp_http-echo_https
75+
// backend e2e-tests-crd-tcp_svc_http-echo_https
7676
// mode tcp
7777
// balance roundrobin
7878
// no option abortonclose
@@ -107,7 +107,7 @@ func (suite *TCPSuiteBackendSwitchingRule) Test_CRD_TCP_BackendSwitchingRule() {
107107
var ok bool
108108
if res.StatusCode == 200 {
109109
body, _ := io.ReadAll(res.Body)
110-
ok = !strings.HasPrefix(string(body), "http-echo-0") && !strings.HasPrefix(string(body), "http-echo-1")
110+
ok = !strings.HasPrefix(string(body), "svc_http-echo-0") && !strings.HasPrefix(string(body), "svc_http-echo-1")
111111
}
112112
return ok
113113
}, e2e.WaitDuration, e2e.TickDuration)

0 commit comments

Comments
 (0)