Skip to content

Commit 184f968

Browse files
authored
Merge pull request #81 from nicomfer/support_tcp_checks_listens
Add support for tcp-checks in listen blocks
2 parents 3b37f73 + ff7aa11 commit 184f968

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

haproxy/templates/haproxy.jinja

+9
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,15 @@ listen {{ listener.get('name', listener_name) }}
268268
http-check {{ listener.httpcheck }}
269269
{%- endif %}
270270
{%- endif %}
271+
{%- if 'tcpchecks' in listener %}
272+
{%- if listener.tcpchecks is string %}
273+
tcp-check {{ listener.tcpchecks }}
274+
{%- else %}
275+
{%- for tcpcheck in listener.tcpchecks %}
276+
tcp-check {{ tcpcheck }}
277+
{%- endfor %}
278+
{%- endif %}
279+
{%- endif %}
271280
{%- if 'reqadds' in listener %}
272281
{%- if listener.reqadds is string %}
273282
reqadd {{ listener.reqadds }}

pillar.example

+26-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,32 @@ haproxy:
123123
check: check
124124
web3:
125125
host: web3.example.com
126-
126+
redis:
127+
bind:
128+
- '*:6379'
129+
balance: roundrobin
130+
defaultserver:
131+
fall: 3
132+
options:
133+
- tcp-check
134+
tcpchecks:
135+
- send PINGrn
136+
- expect string +PONG
137+
- send info replicationrn
138+
- expect string role:master
139+
- send QUITrn
140+
- expect string +OK
141+
servers:
142+
server1:
143+
host: server1
144+
port: 6379
145+
check: check
146+
extra: port 6379 inter 1s
147+
server2:
148+
host: server2
149+
port: 6379
150+
check: check
151+
extra: port 6379 inter 1s backup
127152
frontends:
128153
frontend1:
129154
name: www-http

0 commit comments

Comments
 (0)