updated haproxy state

This commit is contained in:
Paul 2023-10-10 09:07:44 +02:00
parent 62b8bbaba4
commit b224c6843e

View File

@ -23,6 +23,7 @@ http-response return status 404 content-type text/html string "<h1>404 not found
{%- macro httpsslrules(h2=False) -%}ssl verify none{{ " alpn h2,http/1.1" if h2 }}{%- endmacro -%} {%- macro httpsslrules(h2=False) -%}ssl verify none{{ " alpn h2,http/1.1" if h2 }}{%- endmacro -%}
{%- macro httpendpoints(servers=[], check=True, disabled=False) -%} {%- macro httpendpoints(servers=[], check=True, disabled=False) -%}
{%- if servers -%}
{%- for server in servers %} {%- for server in servers %}
{% if server.name in haproxy.servers.keys() -%} {% if server.name in haproxy.servers.keys() -%}
{%- set addr = haproxy.servers[server.name][0] -%} {%- set addr = haproxy.servers[server.name][0] -%}
@ -31,9 +32,11 @@ http-response return status 404 content-type text/html string "<h1>404 not found
{%- endif -%} {%- endif -%}
server {{ server.name }} {{ addr }}:{{ server.port }}{{ " " + httpcheckrules(inter=server.inter|default("1s"), fall=server.fall|default(5), rise=server.rise|default(5)) if check }}{{ " " + httpsslrules(server.h2|default(False)) if server.ssl|default(False) }}{{ " disabled" if server.disabled|default(False) }}{{ " send-proxy" if server.proxy|default(False) }}{{ " on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }} server {{ server.name }} {{ addr }}:{{ server.port }}{{ " " + httpcheckrules(inter=server.inter|default("1s"), fall=server.fall|default(5), rise=server.rise|default(5)) if check }}{{ " " + httpsslrules(server.h2|default(False)) if server.ssl|default(False) }}{{ " disabled" if server.disabled|default(False) }}{{ " send-proxy" if server.proxy|default(False) }}{{ " on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }}
{%- endfor %} {%- endfor %}
{%- endif -%}
{%- endmacro -%} {%- endmacro -%}
{%- macro tcpendpoints(servers=[], check=True) -%} {%- macro tcpendpoints(servers=[], check=True) -%}
{%- if servers -%}
{%- for server in servers %} {%- for server in servers %}
{% if server.name in haproxy.servers.keys() -%} {% if server.name in haproxy.servers.keys() -%}
{%- set addr = haproxy.servers[server.name][0] -%} {%- set addr = haproxy.servers[server.name][0] -%}
@ -42,6 +45,7 @@ http-response return status 404 content-type text/html string "<h1>404 not found
{%- 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 on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }}
{%- endfor %} {%- endfor %}
{%- endif -%}
{%- endmacro -%} {%- endmacro -%}
{%- macro cache() -%} {%- macro cache() -%}
@ -270,7 +274,7 @@ backend {{ name }} from {{ haproxy.config.namespace }}
{%- if values.internal|default(False) %} {%- if values.internal|default(False) %}
{{ internal() }} {{ internal() }}
{%- endif %} {%- endif %}
{{- httpendpoints(servers=values.servers, check=values.check|default(haproxy.config.check)) }} {{- httpendpoints(servers=values.servers|default([]), check=values.check|default(haproxy.config.check)) }}
{%- endif %} {%- endif %}
{% endfor %} {% endfor %}
@ -290,7 +294,7 @@ listen {{ name }} from {{ haproxy.config.namespace }}
option spop-check option spop-check
{%- endif %} {%- endif %}
default-server inter 1s fall 5 default-server inter 1s fall 5
{{- tcpendpoints(servers=values.servers, check=values.check|default(haproxy.config.check)) }} {{- tcpendpoints(servers=values.servers|default([]), check=values.check|default(haproxy.config.check)) }}
{% endfor %} {% endfor %}
# SPOE Agents # SPOE Agents