added proxyprotocol options
This commit is contained in:
parent
d130ea4e2b
commit
5de98614da
4 changed files with 23 additions and 19 deletions
|
|
@ -21,9 +21,11 @@ type LoadBalancer struct {
|
|||
}
|
||||
|
||||
type Options struct {
|
||||
Frontend []string `json:"frontend,omitempty"`
|
||||
Backend []string `json:"backend,omitempty"`
|
||||
DefaultServer string `json:"defaultServer,omitempty`
|
||||
Frontend []string `json:"frontend,omitempty"`
|
||||
Backend []string `json:"backend,omitempty"`
|
||||
ProxyProtocol string `json:"proxyProtocol,omitempty"`
|
||||
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
||||
DefaultServer string `json:"defaultServer,omitempty`
|
||||
}
|
||||
|
||||
type Port struct {
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@ type LoadBalancer struct {
|
|||
}
|
||||
|
||||
type Options struct {
|
||||
Frontend []string `json:"frontend"`
|
||||
Backend []string `json:"backend"`
|
||||
DefaultServer string `json:"defaultServer"`
|
||||
Frontend []string `json:"frontend"`
|
||||
Backend []string `json:"backend"`
|
||||
ProxyProtocol string `json:"proxyProtocol"`
|
||||
CheckProxyProtocol bool `json:"checkProxyProtocol"`
|
||||
DefaultServer string `json:"defaultServer"`
|
||||
}
|
||||
|
||||
type Port struct {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package haproxy
|
|||
|
||||
const haproxyConfigTemplate = `global
|
||||
daemon
|
||||
# TODO
|
||||
#chroot /var/lib/haproxy
|
||||
chroot /usr/share/haproxy
|
||||
pidfile /run/haproxy.pid
|
||||
|
|
@ -31,20 +32,21 @@ frontend fr_{{ $item.Name }}_{{ $port.Port }}
|
|||
{{- range $opt := $item.Options.Frontend }}
|
||||
option {{ $opt }}
|
||||
{{- end }}
|
||||
# option tcplog
|
||||
# option splice-request
|
||||
default_backend ba_{{ $item.Name }}_{{ $port.Port }}
|
||||
backend ba_{{ $item.Name }}_{{ $port.Port }}
|
||||
balance roundrobin
|
||||
{{- range $opt := $item.Options.Backend }}
|
||||
option {{ $opt }}
|
||||
{{- end }}
|
||||
# option splice-response
|
||||
# option httpchk GET /
|
||||
default-server inter 3s downinter 10s fall 2 rise 2 on-marked-down shutdown-sessions {{ $item.Options.DefaultServer }}
|
||||
# send-proxy-v2
|
||||
# check-send-proxy
|
||||
# port <healthCheckNodePort>
|
||||
{{- if eq $item.Options.ProxyProtocol "v1" }}
|
||||
send-proxy
|
||||
{{- else if eq $item.Options.ProxyProtocol "v2" }}
|
||||
send-proxy-v2
|
||||
{{- end }}
|
||||
{{- if $item.Options.CheckProxyProtocol }}
|
||||
check-send-proxy
|
||||
{{- end }}
|
||||
{{- range $srv := $port.Servers }}
|
||||
server {{ $srv.Name }} {{ $srv.IP }}:{{ $srv.Port }} check
|
||||
{{- end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue