允许修改配置ingress port

pull/1006/head
Rurui Ye 2021-04-02 14:45:10 +08:00 committed by jmgao
parent 421dd0b3b3
commit 6064aa36c6
2 changed files with 14 additions and 9 deletions

View File

@ -11,8 +11,13 @@ BALANCE_ALG: "roundrobin"
# 启用 ingress NodePort服务的负载均衡 (yes/no)
INGRESS_NODEPORT_LB: "no"
# ingress NodePort 的端口号
INGRESS_NODEPORT_LB_PORT: 23456
# 启用 ingress tls NodePort服务的负载均衡 (yes/no)
INGRESS_TLS_NODEPORT_LB: "no"
# ingress tls NodePort 的端口号
INGRESS_TLS_NODEPORT_LB_PORT: 23457
# 离线安装 haproxy+keepalived (offline|online)
INSTALL_SOURCE: "online"

View File

@ -33,12 +33,12 @@ listen ingress-node
option dontlog-normal
balance {{ BALANCE_ALG }}
{% if groups['kube_node']|length > 3 %}
server {{ groups['kube_node'][0] }} {{ groups['kube_node'][0] }}:23456 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][1] }} {{ groups['kube_node'][1] }}:23456 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][2] }} {{ groups['kube_node'][2] }}:23456 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][0] }} {{ groups['kube_node'][0] }}:{{INGRESS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][1] }} {{ groups['kube_node'][1] }}:{{INGRESS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][2] }} {{ groups['kube_node'][2] }}:{{INGRESS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
{% else %}
{% for host in groups['kube_node'] %}
server {{ host }} {{ host }}:23456 check inter 5s fall 2 rise 2 weight 1
server {{ host }} {{ host }}:{{INGRESS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
{% endfor %}
{% endif %}
{% endif %}
@ -52,12 +52,12 @@ listen ingress-node-tls
option dontlog-normal
balance {{ BALANCE_ALG }}
{% if groups['kube_node']|length > 3 %}
server {{ groups['kube_node'][0] }} {{ groups['kube_node'][0] }}:23457 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][1] }} {{ groups['kube_node'][1] }}:23457 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][2] }} {{ groups['kube_node'][2] }}:23457 check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][0] }} {{ groups['kube_node'][0] }}:{{INGRESS_TLS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][1] }} {{ groups['kube_node'][1] }}:{{INGRESS_TLS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
server {{ groups['kube_node'][2] }} {{ groups['kube_node'][2] }}:{{INGRESS_TLS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
{% else %}
{% for host in groups['kube_node'] %}
server {{ host }} {{ host }}:23457 check inter 5s fall 2 rise 2 weight 1
server {{ host }} {{ host }}:{{INGRESS_TLS_NODEPORT_LB_PORT}} check inter 5s fall 2 rise 2 weight 1
{% endfor %}
{% endif %}
{% endif %}