forked from Hexio-io/haproxy-k8s-lb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaproxy.template.cfg
53 lines (49 loc) · 1.69 KB
/
haproxy.template.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
global
log 127.0.0.1 local2
log stdout format raw local0
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
stats socket /var/lib/haproxy/stats
spread-checks {{config.global.spreadChecks}}
tune.maxrewrite {{config.global.tuneMaxRewrite}}
tune.bufsize {{config.global.tuneBufferSize}}
maxconn {{config.global.maxconn}}
defaults
mode tcp
log global
stats enable
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries {{config.retries}}
timeout http-request {{config.timeoutHttpRequest}}
timeout queue {{config.timeoutQueue}}
timeout connect {{config.timeoutConnect}}
timeout client {{config.timeoutClient}}
timeout server {{config.timeoutServer}}
timeout http-keep-alive {{config.timeoutHttpKeepAlive}}
timeout check {{config.timeoutCheck}}
maxconn {{config.maxconn}}
{{#if config.prometheusEnable}}
listen prometheus
mode http
bind {{config.prometheusBindAddress}}:{{config.prometheusBindPort}}
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
{{/if}}
{{#each services}}
{{#each ports}}
{{#if valid}}
listen svc-{{../name}}
mode {{protocol}}
balance roundrobin
bind {{../bindAddress}}:{{bindPort}}
{{#each ../../nodes}}
server {{name}} {{ipAddress}}:{{../nodePort}} check
{{/each}}
{{/if}}
{{/each}}
{{/each}}