Skip to content

Commit 21bddcc

Browse files
hdurand0710Gopher Bot
authored andcommitted
DOC/MEDIUM: update examples with v3 CRD for TCP CR
1 parent ef11dd9 commit 21bddcc

2 files changed

Lines changed: 126 additions & 131 deletions

File tree

documentation/custom-resource-tcp.md

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,32 @@ The definition can be found [definitions](../crs/definition/)
3030
Current implementation relies on the client-native library and its models to configure HAProxy.
3131

3232
```yaml
33-
apiVersion: ingress.v1.haproxy.org/v1
33+
apiVersion: ingress.v3.haproxy.org/v3
3434
kind: TCP
3535
metadata:
36-
name: tcp-1
37-
namespace: test
3836
annotations:
3937
ingress.class: haproxy
38+
name: tcp-1
39+
namespace: test
4040
spec:
41-
- name: tcp-http-echo-8443
42-
frontend:
43-
name: fe-http-echo-8443
44-
tcplog: true
45-
log_format: "%{+Q}o %t %s"
46-
binds:
47-
- name: v4
48-
port: 32766
49-
- name: v4v6
50-
address: "::"
51-
port: 32766
52-
v4v6: true
53-
service:
54-
name: "http-echo"
55-
port: 8443
41+
- frontend:
42+
binds:
43+
v4:
44+
name: v4
45+
port: 32766
46+
v4v6:
47+
address: '::'
48+
name: v4v6
49+
port: 32766
50+
v4v6: true
51+
log_format: '%{+Q}o %t %s'
52+
name: fe-http-echo-8443
53+
tcplog: true
54+
name: tcp-http-echo-8443
55+
service:
56+
name: http-echo
57+
port: 8443
58+
5659
```
5760

5861
A `TCP` CR contains a list of TCP services definitions.
@@ -233,23 +236,23 @@ For example, by adding the following Backend CR in the `test` namespace:
233236
<summary>Backend CR</summary>
234237

235238
```yaml
236-
apiVersion: ingress.v1.haproxy.org/v1
239+
apiVersion: ingress.v3.haproxy.org/v3
237240
kind: Backend
238241
metadata:
239242
name: mybackend
240243
namespace: haproxy-controller
241244
spec:
242-
config:
243-
mode: http
244-
balance:
245-
algorithm: "leastconn"
246-
abortonclose: disabled
247-
name: toto
248-
default_server:
249-
verify: none
250-
resolve-prefer: ipv4
251-
check-sni: example.com
252-
sni: str(example.com)
245+
abortonclose: disabled
246+
balance:
247+
algorithm: leastconn
248+
default_server:
249+
check-sni: example.com
250+
resolve-prefer: ipv4
251+
sni: str(example.com)
252+
verify: none
253+
mode: http
254+
name: toto
255+
253256
```
254257
</details>
255258

@@ -279,25 +282,26 @@ In case several TCPs (*accross all namespaces*) have this kind of collisions, we
279282

280283
For example, with using the previous `http-echo` deployement and service, and the already deplyed TCP `tcp-1` in namespace `test`, if we try to deploy the following TCP (that has a collision on Address/Port with the existing TCP `tcp-1`):
281284
```yaml
282-
apiVersion: ingress.v1.haproxy.org/v1
285+
apiVersion: ingress.v3.haproxy.org/v3
283286
kind: TCP
284287
metadata:
285-
name: tcp-2
286-
namespace: test
287288
annotations:
288289
ingress.class: haproxy
290+
name: tcp-2
291+
namespace: test
289292
spec:
290-
- name: tcp-http-echo-test2-8443
291-
frontend:
292-
name: fe-http-echo-test2-8443
293-
tcplog: true
294-
log_format: "%{+Q}o"
295-
binds:
296-
- name: v4
297-
port: 32766
298-
service:
299-
name: "http-echo"
300-
port: 8443
293+
- frontend:
294+
binds:
295+
v4:
296+
name: v4
297+
port: 32766
298+
log_format: '%{+Q}o'
299+
name: fe-http-echo-test2-8443
300+
tcplog: true
301+
name: tcp-http-echo-test2-8443
302+
service:
303+
name: http-echo
304+
port: 8443
301305
```
302306
303307
@@ -320,31 +324,33 @@ explaining that :
320324
To setup SSL in a TCP CR (with the same Service and Pod defined above):
321325

322326
```yaml
323-
apiVersion: ingress.v1.haproxy.org/v1
327+
apiVersion: ingress.v3.haproxy.org/v3
324328
kind: TCP
325329
metadata:
326-
name: tcp-1
327-
namespace: test
328330
annotations:
329331
ingress.class: haproxy
332+
name: tcp-1
333+
namespace: test
330334
spec:
331-
- name: tcp-http-echo-443
332-
frontend:
333-
name: fe-http-echo-443
334-
tcplog: true
335-
log_format: "%{+Q}o %t %s"
336-
binds:
337-
- name: v4
338-
ssl: true
339-
ssl_certificate: tcp-test-cert
340-
port: 32766
341-
- name: v4v6
342-
address: "::"
343-
port: 32766
344-
v4v6: true
345-
service:
346-
name: "http-echo"
347-
port: 443
335+
- frontend:
336+
binds:
337+
v4:
338+
name: v4
339+
port: 32766
340+
ssl: true
341+
ssl_certificate: tcp-test-cert
342+
v4v6:
343+
address: '::'
344+
name: v4v6
345+
port: 32766
346+
v4v6: true
347+
log_format: '%{+Q}o %t %s'
348+
name: fe-http-echo-443
349+
tcplog: true
350+
name: tcp-http-echo-443
351+
service:
352+
name: http-echo
353+
port: 443
348354
---
349355
kind: Secret
350356
apiVersion: v1
Lines changed: 56 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,61 @@
1-
apiVersion: ingress.v1.haproxy.org/v1
1+
apiVersion: ingress.v3.haproxy.org/v3
22
kind: TCP
33
metadata:
4-
name: tcp-1
54
annotations:
65
ingress.class: haproxy
6+
name: tcp-1
77
spec:
8-
- name: tcp-test
9-
frontend:
10-
name: fe-http-echo
11-
tcplog: true
12-
log_format: "%{+Q}o %t %s"
13-
binds:
14-
- name: v4
15-
address: 0.0.0.0
16-
port: 32766
17-
acl_list:
18-
- acl_name: switch_be_0
19-
criterion: req_ssl_sni
20-
index: 0
21-
value: -i backend0.example.com
22-
- acl_name: switch_be_1
23-
criterion: req_ssl_sni
24-
index: 1
25-
value: -i backend1.example.com
26-
backend_switching_rule_list:
27-
- cond: if
28-
cond_test: "switch_be_0"
29-
index: 0
30-
name: e2e-tests-crd-tcp_svc_http-echo-0_https
31-
- cond: if
32-
cond_test: "switch_be_1"
33-
index: 1
34-
name: e2e-tests-crd-tcp_svc_http-echo-1_https
35-
capture_list:
36-
- index: 0
37-
type: request
38-
length: 12345
39-
- index: 1
40-
type: response
41-
length: 54321
42-
filter_list:
43-
- index: 0
44-
type: trace
45-
trace_name: BEFORE-HTTP-COMP
46-
- index: 1
47-
type: compression
48-
- index: 2
49-
type: trace
50-
trace_name: AFTER-HTTP-COMP
51-
log_target_list:
52-
- index: 0
53-
facility: daemon
54-
address: stdout
55-
format: raw
56-
tcp_request_rule_list:
57-
- type: inspect-delay
58-
timeout: 5000
59-
index: 0
60-
- type: content
61-
action: accept
62-
cond: if
63-
cond_test: "{ req_ssl_hello_type 1 }"
64-
index: 1
65-
service:
66-
name: "http-echo"
67-
port: 443
68-
services:
69-
- name: "http-echo-0"
70-
port: 443
71-
- name: "http-echo-1"
72-
port: 443
8+
- frontend:
9+
acl_list:
10+
- acl_name: switch_be_0
11+
criterion: req_ssl_sni
12+
value: -i backend0.example.com
13+
- acl_name: switch_be_1
14+
criterion: req_ssl_sni
15+
value: -i backend1.example.com
16+
backend_switching_rule_list:
17+
- cond: if
18+
cond_test: switch_be_0
19+
name: e2e-tests-crd-tcp_svc_http-echo-0_https
20+
- cond: if
21+
cond_test: switch_be_1
22+
name: e2e-tests-crd-tcp_svc_http-echo-1_https
23+
binds:
24+
v4:
25+
address: 0.0.0.0
26+
name: v4
27+
port: 32766
28+
capture_list:
29+
- length: 12345
30+
type: request
31+
- length: 54321
32+
type: response
33+
filter_list:
34+
- trace_name: BEFORE-HTTP-COMP
35+
type: trace
36+
- type: compression
37+
- trace_name: AFTER-HTTP-COMP
38+
type: trace
39+
log_format: '%{+Q}o %t %s'
40+
log_target_list:
41+
- address: stdout
42+
facility: daemon
43+
format: raw
44+
name: fe-http-echo
45+
tcp_request_rule_list:
46+
- timeout: 5000
47+
type: inspect-delay
48+
- action: accept
49+
cond: if
50+
cond_test: '{ req_ssl_hello_type 1 }'
51+
type: content
52+
tcplog: true
53+
name: tcp-test
54+
service:
55+
name: http-echo
56+
port: 443
57+
services:
58+
- name: http-echo-0
59+
port: 443
60+
- name: http-echo-1
61+
port: 443

0 commit comments

Comments
 (0)