Skip to content

Commit

Permalink
Merge pull request #86 from ze42/httpchecks
Browse files Browse the repository at this point in the history
feat(httpchecks): support multiple httpcheck lines
  • Loading branch information
myii authored Apr 8, 2022
2 parents b3f0d86 + 8977843 commit da220d8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
20 changes: 18 additions & 2 deletions haproxy/templates/haproxy.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ listen {{ listener.get('name', listener_name) }}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if 'httpcheck' in listener %}
{%- if 'httpchecks' in listener %}
{%- if listener.httpchecks is string %}
http-check {{ listener.httpchecks }}
{%- else %}
{%- for httpcheck in listener.httpchecks %}
http-check {{ httpcheck }}
{%- endfor %}
{%- endif %}
{%- elif 'httpcheck' in listener %}{# deprecated: but for compatibility #}
{%- if listener.httpcheck is string %}
http-check {{ listener.httpcheck }}
{%- endif %}
Expand Down Expand Up @@ -547,7 +555,15 @@ backend {{ backend.get('name', backend_name) }}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if 'httpcheck' in backend %}
{%- if 'httpchecks' in backend %}
{%- if backend.httpchecks is string %}
http-check {{ backend.httpchecks }}
{%- else %}
{%- for httpcheck in backend.httpchecks %}
http-check {{ httpcheck }}
{%- endfor %}
{%- endif %}
{%- elif 'httpcheck' in backend %}{# deprecated: but for compatibility #}
{%- if backend.httpcheck is string %}
http-check {{ backend.httpcheck }}
{%- endif %}
Expand Down
7 changes: 7 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ haproxy:
bind:
- "0.0.0.0:8998"
mode: http
options:
- httpchk
httpcheck: disable-on-404
stats:
enable: true
uri: "/admin?stats"
Expand All @@ -109,11 +112,15 @@ haproxy:
options:
- forwardfor
- http-server-close
- httpchk
defaultserver:
slowstart: 60s
maxconn: 256
maxqueue: 128
weight: 100
httpchecks:
- send-state
- expect status 200
servers:
web1:
host: web1.example.com
Expand Down
7 changes: 7 additions & 0 deletions test/salt/pillar/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ haproxy:
bind:
- "0.0.0.0:8998"
mode: http
options:
- httpchk
httpcheck: disable-on-404
stats:
enable: true
uri: "/admin?stats"
Expand All @@ -89,11 +92,15 @@ haproxy:
options:
- forwardfor
- http-server-close
- httpchk
defaultserver:
slowstart: 60s
maxconn: 256
maxqueue: 128
weight: 100
httpchecks:
- send-state
- expect status 200
servers:
web1:
host: web1.example.com
Expand Down

0 comments on commit da220d8

Please sign in to comment.