Skip to content

Commit da220d8

Browse files
authored
Merge pull request #86 from ze42/httpchecks
feat(httpchecks): support multiple httpcheck lines
2 parents b3f0d86 + 8977843 commit da220d8

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

haproxy/templates/haproxy.jinja

+18-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,15 @@ listen {{ listener.get('name', listener_name) }}
266266
{%- endfor %}
267267
{%- endif %}
268268
{%- endif %}
269-
{%- if 'httpcheck' in listener %}
269+
{%- if 'httpchecks' in listener %}
270+
{%- if listener.httpchecks is string %}
271+
http-check {{ listener.httpchecks }}
272+
{%- else %}
273+
{%- for httpcheck in listener.httpchecks %}
274+
http-check {{ httpcheck }}
275+
{%- endfor %}
276+
{%- endif %}
277+
{%- elif 'httpcheck' in listener %}{# deprecated: but for compatibility #}
270278
{%- if listener.httpcheck is string %}
271279
http-check {{ listener.httpcheck }}
272280
{%- endif %}
@@ -547,7 +555,15 @@ backend {{ backend.get('name', backend_name) }}
547555
{%- endfor %}
548556
{%- endif %}
549557
{%- endif %}
550-
{%- if 'httpcheck' in backend %}
558+
{%- if 'httpchecks' in backend %}
559+
{%- if backend.httpchecks is string %}
560+
http-check {{ backend.httpchecks }}
561+
{%- else %}
562+
{%- for httpcheck in backend.httpchecks %}
563+
http-check {{ httpcheck }}
564+
{%- endfor %}
565+
{%- endif %}
566+
{%- elif 'httpcheck' in backend %}{# deprecated: but for compatibility #}
551567
{%- if backend.httpcheck is string %}
552568
http-check {{ backend.httpcheck }}
553569
{%- endif %}

pillar.example

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ haproxy:
9999
bind:
100100
- "0.0.0.0:8998"
101101
mode: http
102+
options:
103+
- httpchk
104+
httpcheck: disable-on-404
102105
stats:
103106
enable: true
104107
uri: "/admin?stats"
@@ -109,11 +112,15 @@ haproxy:
109112
options:
110113
- forwardfor
111114
- http-server-close
115+
- httpchk
112116
defaultserver:
113117
slowstart: 60s
114118
maxconn: 256
115119
maxqueue: 128
116120
weight: 100
121+
httpchecks:
122+
- send-state
123+
- expect status 200
117124
servers:
118125
web1:
119126
host: web1.example.com

test/salt/pillar/default.sls

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ haproxy:
7979
bind:
8080
- "0.0.0.0:8998"
8181
mode: http
82+
options:
83+
- httpchk
84+
httpcheck: disable-on-404
8285
stats:
8386
enable: true
8487
uri: "/admin?stats"
@@ -89,11 +92,15 @@ haproxy:
8992
options:
9093
- forwardfor
9194
- http-server-close
95+
- httpchk
9296
defaultserver:
9397
slowstart: 60s
9498
maxconn: 256
9599
maxqueue: 128
96100
weight: 100
101+
httpchecks:
102+
- send-state
103+
- expect status 200
97104
servers:
98105
web1:
99106
host: web1.example.com

0 commit comments

Comments
 (0)