Add support for down parameter for upstreams (#278)

This commit is contained in:
Pritpal Sabharwal 2020-07-06 05:36:34 -07:00 committed by GitHub
parent 63325aac0b
commit a0a49176a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -242,6 +242,10 @@
address: unix:/var/run/control.unit.sock address: unix:/var/run/control.unit.sock
weight: 1 weight: 1
health_check: max_fails=3 fail_timeout=5s health_check: max_fails=3 fail_timeout=5s
backend_server_3:
address: 0.0.0.0
port: 8083
down: true
frontend: frontend:
template_file: http/default.conf.j2 template_file: http/default.conf.j2
conf_file_name: frontend_default.conf conf_file_name: frontend_default.conf
@ -378,3 +382,7 @@
port: 8091 port: 8091
weight: 1 weight: 1
health_check: max_fails=1 fail_timeout=10s health_check: max_fails=1 fail_timeout=10s
backend_server_2:
address: 0.0.0.0
port: 8092
down: true

View File

@ -10,7 +10,7 @@ upstream {{ item.value.upstreams[upstream].name }} {
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }}; zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
{% endif %} {% endif %}
{% for server in item.value.upstreams[upstream].servers %} {% for server in item.value.upstreams[upstream].servers %}
server {{ item.value.upstreams[upstream].servers[server].address }}{{(":" + item.value.upstreams[upstream].servers[server].port | string) if item.value.upstreams[upstream].servers[server].port is defined}} weight={{ item.value.upstreams[upstream].servers[server].weight | default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check | default("") }}; server {{ item.value.upstreams[upstream].servers[server].address }}{{(":" + item.value.upstreams[upstream].servers[server].port | string) if item.value.upstreams[upstream].servers[server].port is defined}} {% if item.value.upstreams[upstream].servers[server].down is defined and item.value.upstreams[upstream].servers[server].down %}down{% else %}weight={{ item.value.upstreams[upstream].servers[server].weight | default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check | default("") }}{% endif %};
{% endfor %} {% endfor %}
{% if item.value.upstreams[upstream].sticky_cookie %} {% if item.value.upstreams[upstream].sticky_cookie %}
sticky cookie srv_id expires=1h path=/; sticky cookie srv_id expires=1h path=/;

View File

@ -8,7 +8,7 @@ upstream {{ item.value.upstreams[upstream].name }} {
{% endif %} {% endif %}
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }}; zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
{% for server in item.value.upstreams[upstream].servers %} {% for server in item.value.upstreams[upstream].servers %}
server {{ item.value.upstreams[upstream].servers[server].address }}:{{ item.value.upstreams[upstream].servers[server].port }} weight={{ item.value.upstreams[upstream].servers[server].weight|default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check|default("") }}; server {{ item.value.upstreams[upstream].servers[server].address }}{{(":" + item.value.upstreams[upstream].servers[server].port | string) if item.value.upstreams[upstream].servers[server].port is defined}} {% if item.value.upstreams[upstream].servers[server].down is defined and item.value.upstreams[upstream].servers[server].down %}down{% else %}weight={{ item.value.upstreams[upstream].servers[server].weight | default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check | default("") }}{% endif %};
{% endfor %} {% endfor %}
{% if item.value.upstreams[upstream].sticky_cookie is defined %} {% if item.value.upstreams[upstream].sticky_cookie is defined %}
{% if item.value.upstreams[upstream].sticky_cookie %} {% if item.value.upstreams[upstream].sticky_cookie %}