updated haproxy state

This commit is contained in:
Paul 2023-12-18 19:32:14 +01:00
parent 3aa818ade8
commit 0b25a888b1

View File

@ -25,7 +25,9 @@ http-response return status 404 content-type text/html string "<h1>404 not found
{%- macro httpendpoints(servers=[], check=True, disabled=False) -%} {%- macro httpendpoints(servers=[], check=True, disabled=False) -%}
{%- if servers -%} {%- if servers -%}
{%- for server in servers %} {%- for server in servers %}
{% if server.name in haproxy.servers.keys() -%} {% if "addr" in server.keys() -%}
{%- set addr = server.addr -%}
{%- elif server.name in haproxy.servers.keys() -%}
{%- set addr = haproxy.servers[server.name][0] -%} {%- set addr = haproxy.servers[server.name][0] -%}
{%- else -%} {%- else -%}
{%- set addr = server.name -%} {%- set addr = server.name -%}
@ -38,12 +40,14 @@ http-response return status 404 content-type text/html string "<h1>404 not found
{%- macro tcpendpoints(servers=[], check=True) -%} {%- macro tcpendpoints(servers=[], check=True) -%}
{%- if servers -%} {%- if servers -%}
{%- for server in servers %} {%- for server in servers %}
{% if server.name in haproxy.servers.keys() -%} {% if "addr" in server.keys() -%}
{%- set addr = server.addr -%}
{%- elif server.name in haproxy.servers.keys() -%}
{%- set addr = haproxy.servers[server.name][0] -%} {%- set addr = haproxy.servers[server.name][0] -%}
{%- else -%} {%- else -%}
{%- set addr = server.name -%} {%- set addr = server.name -%}
{%- endif -%} {%- endif -%}
server {{ server.name }} {{ addr }}:{{ server.port }}{{ " check" if check }}{{ " backup" if server.backup|default(False) }} port {{ server.port }}{{ " on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }} server {{ server.name }} {{ addr }}:{{ server.port }}{{ " check" if check }}{{ " backup" if server.backup|default(False) }} port {{ server.port }}{{ " on-marked-down shutdown-sessions" if server.killsessions|default(False) }}
{%- endfor %} {%- endfor %}
{%- endif -%} {%- endif -%}
{%- endmacro -%} {%- endmacro -%}
@ -290,6 +294,8 @@ listen {{ name }} from {{ haproxy.config.namespace }}
mode tcp mode tcp
option tcplog option tcplog
option tcpka option tcpka
stick-table type ip size 10k peers paulbsd
stick on dst
{%- if values.type == "postgres" %} {%- if values.type == "postgres" %}
option pgsql-check user repmgr option pgsql-check user repmgr
{%- endif %} {%- endif %}