Rainbond/hack/contrib/docker/gateway/nginxtmp/tcp_udp_servers.tmpl
barnettZQG f1dd2384ed support dynamically update tcp or udp upstream;
fix bug that Ingress was unable to remove all when the component was closed;
2020-02-03 23:18:37 +08:00

28 lines
985 B
Cheetah

# TCP services
{{ range $tcpServer := .TCPBackends }}
server {
preread_by_lua_block {
ngx.var.proxy_upstream_name="{{ $tcpServer.UpstreamName }}";
}
{{ if .Listen }}listen {{.Listen}} {{ if $tcpServer.ProxyProtocol.Decode }} proxy_protocol{{ end }};{{ end }}
proxy_timeout {{ $tcpServer.ProxyStreamTimeout }};
proxy_pass upstream_balancer;
{{ if $tcpServer.ProxyProtocol.Encode }}
proxy_protocol on;
{{ end }}
}
{{ end }}
# UDP services
{{ range $udpServer := .UDPBackends }}
server {
preread_by_lua_block {
ngx.var.proxy_upstream_name="{{ $udpServer.UpstreamName }}";
}
{{ if $udpServer.Listen }}listen {{$udpServer.Listen}} {{ if $udpServer.ProxyProtocol.Decode }} proxy_protocol{{ end }};{{ end }}
proxy_responses {{ $udpServer.ProxyStreamResponses }};
proxy_timeout {{ $udpServer.ProxyStreamTimeout }};
proxy_pass upstream_balancer;
}
{{ end }}