traefik/autogen/gentemplates/gen.go

2610 lines
89 KiB
Go
Raw Normal View History

2017-11-20 14:26:03 +00:00
// Code generated by go-bindata.
// sources:
// templates/consul_catalog.tmpl
// templates/docker.tmpl
// templates/ecs.tmpl
// templates/eureka.tmpl
// templates/kubernetes.tmpl
// templates/kv.tmpl
// templates/marathon.tmpl
// templates/mesos.tmpl
// templates/notFound.tmpl
// templates/rancher.tmpl
// DO NOT EDIT!
package gentemplates
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
type asset struct {
bytes []byte
info os.FileInfo
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
2017-11-22 11:00:04 +00:00
var _templatesConsul_catalogTmpl = []byte(`[backends]
2018-01-02 19:02:20 +00:00
{{range $service := .Services}}
{{ $backendName := getServiceBackendName $service }}
2017-11-22 11:00:04 +00:00
2018-03-28 22:01:35 +00:00
{{ $circuitBreaker := getCircuitBreaker $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
{{if $circuitBreaker }}
[backends."backend-{{ $backendName }}".circuitBreaker]
2018-01-02 19:02:20 +00:00
expression = "{{ $circuitBreaker.Expression }}"
2017-11-22 11:00:04 +00:00
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $service.TraefikLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-03-28 22:01:35 +00:00
{{ $loadBalancer := getLoadBalancer $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
{{if $loadBalancer }}
[backends."backend-{{ $backendName }}".loadBalancer]
2018-01-02 19:02:20 +00:00
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $backendName }}".loadBalancer.stickiness]
2018-01-02 19:02:20 +00:00
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-02 19:02:20 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
2018-03-28 22:01:35 +00:00
{{ $maxConn := getMaxConn $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
{{if $maxConn }}
[backends."backend-{{ $backendName }}".maxConn]
2018-01-02 19:02:20 +00:00
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-11-22 11:00:04 +00:00
{{end}}
2018-03-28 22:01:35 +00:00
{{ $healthCheck := getHealthCheck $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-02 19:02:20 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $backendName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 19:02:20 +00:00
{{end}}
2018-03-28 22:01:35 +00:00
{{ $buffering := getBuffering $service.TraefikLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".buffering]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-01-02 19:02:20 +00:00
{{end}}
{{range $index, $node := .Nodes}}
2018-03-28 22:01:35 +00:00
{{ $server := getServer $node }}
2018-01-02 19:02:20 +00:00
[backends."backend-{{ getNodeBackendName $node }}".servers."{{ getServerName $node $index }}"]
2018-03-28 22:01:35 +00:00
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2018-01-02 19:02:20 +00:00
2017-11-22 11:00:04 +00:00
{{end}}
[frontends]
2018-01-02 19:02:20 +00:00
{{range $service := .Services}}
[frontends."frontend-{{ $service.ServiceName }}"]
backend = "backend-{{ getServiceBackendName $service }}"
2018-03-28 22:01:35 +00:00
priority = {{ getPriority $service.TraefikLabels }}
passHostHeader = {{ getPassHostHeader $service.TraefikLabels }}
passTLSCert = {{ getPassTLSCert $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
2018-03-28 22:01:35 +00:00
entryPoints = [{{range getFrontEndEntryPoints $service.TraefikLabels }}
2017-11-22 11:00:04 +00:00
"{{.}}",
2018-01-02 19:02:20 +00:00
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $service.TraefikLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $service.ServiceName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $service.ServiceName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $service.ServiceName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."frontend-{{ $service.ServiceName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
2018-08-29 09:36:03 +00:00
{{ $auth := getAuth $service.TraefikLabels }}
2018-07-06 14:52:04 +00:00
{{if $auth }}
[frontends."frontend-{{ $service.ServiceName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."frontend-{{ $service.ServiceName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."frontend-{{ $service.ServiceName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."frontend-{{ $service.ServiceName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."frontend-{{ $service.ServiceName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2018-01-02 19:02:20 +00:00
2018-03-28 22:01:35 +00:00
{{ $whitelist := getWhiteList $service.TraefikLabels }}
{{if $whitelist }}
[frontends."frontend-{{ $service.ServiceName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."frontend-{{ $service.ServiceName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $redirect := getRedirect $service.TraefikLabels }}
2018-01-02 19:02:20 +00:00
{{if $redirect }}
[frontends."frontend-{{ $service.ServiceName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2018-01-02 19:02:20 +00:00
{{end}}
2018-03-28 22:01:35 +00:00
{{ $errorPages := getErrorPages $service.TraefikLabels }}
{{if $errorPages }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".errors]
2018-03-28 22:01:35 +00:00
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $service.ServiceName }}".errors."{{ $pageName }}"]
2018-01-02 19:02:20 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-02 19:02:20 +00:00
query = "{{ $page.Query }}"
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $rateLimit := getRateLimit $service.TraefikLabels }}
{{if $rateLimit }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $service.ServiceName }}".rateLimit.rateSet]
2018-03-28 22:01:35 +00:00
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $service.ServiceName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-02 19:02:20 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $headers := getHeaders $service.TraefikLabels }}
{{if $headers }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-02 19:02:20 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-02 19:02:20 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
2018-01-02 19:02:20 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
2018-01-02 19:02:20 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $headers.CustomRequestHeaders }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
2018-01-02 19:02:20 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.CustomResponseHeaders }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
2018-01-02 19:02:20 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.SSLProxyHeaders }}
2018-01-02 19:02:20 +00:00
[frontends."frontend-{{ $service.ServiceName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
[frontends."frontend-{{ $service.ServiceName }}".routes."route-host-{{ $service.ServiceName }}"]
rule = "{{ getFrontendRule $service }}"
2017-11-22 11:00:04 +00:00
{{end}}
`)
2017-11-20 14:26:03 +00:00
func templatesConsul_catalogTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesConsul_catalogTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesConsul_catalogTmpl() (*asset, error) {
bytes, err := templatesConsul_catalogTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/consul_catalog.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-03-23 12:30:03 +00:00
var _templatesDockerTmpl = []byte(`{{$backendServers := .Servers}}
[backends]
{{range $backendName, $servers := .Servers}}
{{ $backend := index $servers 0 }}
{{ $circuitBreaker := getCircuitBreaker $backend.SegmentLabels }}
{{if $circuitBreaker }}
[backends."backend-{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $backend.SegmentLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-03-23 12:30:03 +00:00
{{ $loadBalancer := getLoadBalancer $backend.SegmentLabels }}
{{if $loadBalancer }}
[backends."backend-{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
{{end}}
{{end}}
{{ $maxConn := getMaxConn $backend.SegmentLabels }}
{{if $maxConn }}
[backends."backend-{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
{{end}}
{{ $healthCheck := getHealthCheck $backend.SegmentLabels }}
{{if $healthCheck }}
[backends."backend-{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-03-23 12:30:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $backendName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-03-23 12:30:03 +00:00
{{end}}
{{ $buffering := getBuffering $backend.SegmentLabels }}
{{if $buffering }}
[backends."backend-{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
{{range $serverName, $server := getServers $servers }}
[backends."backend-{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
{{end}}
{{end}}
[frontends]
{{range $frontendName, $containers := .Frontends }}
{{ $container := index $containers 0 }}
2017-12-19 23:52:56 +00:00
2018-01-09 15:26:03 +00:00
[frontends."frontend-{{ $frontendName }}"]
backend = "backend-{{ getBackendName $container }}"
2018-03-23 12:30:03 +00:00
priority = {{ getPriority $container.SegmentLabels }}
passHostHeader = {{ getPassHostHeader $container.SegmentLabels }}
passTLSCert = {{ getPassTLSCert $container.SegmentLabels }}
2017-12-19 23:52:56 +00:00
2018-03-23 12:30:03 +00:00
entryPoints = [{{range getEntryPoints $container.SegmentLabels }}
2017-12-19 23:52:56 +00:00
"{{.}}",
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $container.SegmentLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Issuer }}
{{if $issuer }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
{{ $auth := getAuth $container.SegmentLabels }}
{{if $auth }}
[frontends."frontend-{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."frontend-{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."frontend-{{ $frontendName }}".auth.basic]
2018-10-04 14:46:03 +00:00
realm = "{{ $auth.Basic.Realm }}"
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."frontend-{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2017-12-15 10:48:03 +00:00
{{ $whitelist := getWhiteList $container.SegmentLabels }}
{{if $whitelist }}
[frontends."frontend-{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."frontend-{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-03-23 12:30:03 +00:00
{{ $redirect := getRedirect $container.SegmentLabels }}
2018-01-09 15:26:03 +00:00
{{if $redirect }}
[frontends."frontend-{{ $frontendName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2018-03-23 12:30:03 +00:00
{{ $errorPages := getErrorPages $container.SegmentLabels }}
2018-01-09 15:26:03 +00:00
{{if $errorPages }}
[frontends."frontend-{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-09 15:26:03 +00:00
status = [{{range $page.Status }}
2017-12-19 23:52:56 +00:00
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-09 15:26:03 +00:00
query = "{{ $page.Query }}"
2017-12-19 23:52:56 +00:00
{{end}}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2018-03-23 12:30:03 +00:00
{{ $rateLimit := getRateLimit $container.SegmentLabels }}
2018-01-09 15:26:03 +00:00
{{if $rateLimit }}
[frontends."frontend-{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
2018-03-23 12:30:03 +00:00
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-09 15:26:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
2017-12-19 23:52:56 +00:00
{{end}}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2018-03-23 12:30:03 +00:00
{{ $headers := getHeaders $container.SegmentLabels }}
2018-01-09 15:26:03 +00:00
{{if $headers }}
[frontends."frontend-{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-09 15:26:03 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
2018-03-23 12:30:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-09 15:26:03 +00:00
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
2018-01-02 08:42:03 +00:00
2018-01-09 15:26:03 +00:00
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
2018-01-02 08:42:03 +00:00
"{{.}}",
{{end}}]
{{end}}
2018-01-09 15:26:03 +00:00
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
2018-01-02 08:42:03 +00:00
"{{.}}",
{{end}}]
{{end}}
2018-01-09 15:26:03 +00:00
{{if $headers.CustomRequestHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
2017-12-19 23:52:56 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-09 15:26:03 +00:00
{{if $headers.CustomResponseHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
2017-12-19 23:52:56 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-09 15:26:03 +00:00
{{if $headers.SSLProxyHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders }}
2017-12-19 23:52:56 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-03-23 12:30:03 +00:00
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2018-01-09 15:26:03 +00:00
[frontends."frontend-{{ $frontendName }}".routes."route-frontend-{{ $frontendName }}"]
2018-03-28 15:18:04 +00:00
rule = "{{ getFrontendRule $container $container.SegmentLabels }}"
2017-12-19 23:52:56 +00:00
2017-11-22 11:00:04 +00:00
{{end}}
`)
2017-11-20 14:26:03 +00:00
func templatesDockerTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesDockerTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesDockerTmpl() (*asset, error) {
bytes, err := templatesDockerTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/docker.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2017-12-20 22:00:52 +00:00
var _templatesEcsTmpl = []byte(`[backends]
2018-01-10 17:28:03 +00:00
{{range $serviceName, $instances := .Services }}
{{ $firstInstance := index $instances 0 }}
2017-12-20 22:00:52 +00:00
2018-08-27 14:32:05 +00:00
{{ $circuitBreaker := getCircuitBreaker $firstInstance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $circuitBreaker }}
[backends."backend-{{ $serviceName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-20 22:00:52 +00:00
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $firstInstance.SegmentLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $serviceName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-08-27 14:32:05 +00:00
{{ $loadBalancer := getLoadBalancer $firstInstance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $loadBalancer }}
[backends."backend-{{ $serviceName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $serviceName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 22:00:52 +00:00
{{end}}
2018-08-27 14:32:05 +00:00
{{ $maxConn := getMaxConn $firstInstance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $maxConn }}
[backends."backend-{{ $serviceName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-20 22:00:52 +00:00
{{end}}
2018-08-27 14:32:05 +00:00
{{ $healthCheck := getHealthCheck $firstInstance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-10 17:28:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $serviceName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-20 22:00:52 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
2018-08-27 14:32:05 +00:00
{{ $buffering := getBuffering $firstInstance.SegmentLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".buffering]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-01-10 17:28:03 +00:00
{{range $serverName, $server := getServers $instances }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".servers."{{ $serverName }}"]
2018-01-10 17:28:03 +00:00
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 22:00:52 +00:00
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 22:00:52 +00:00
[frontends]
2018-01-10 17:28:03 +00:00
{{range $serviceName, $instances := .Services }}
{{range $instance := filterFrontends $instances }}
2017-12-20 22:00:52 +00:00
2018-08-27 14:32:05 +00:00
{{ $frontendName := getFrontendName $instance }}
[frontends."frontend-{{ $frontendName }}"]
2017-12-20 22:00:52 +00:00
backend = "backend-{{ $serviceName }}"
2018-08-27 14:32:05 +00:00
priority = {{ getPriority $instance.SegmentLabels }}
passHostHeader = {{ getPassHostHeader $instance.SegmentLabels }}
passTLSCert = {{ getPassTLSCert $instance.SegmentLabels }}
2017-12-20 22:00:52 +00:00
2018-08-27 14:32:05 +00:00
entryPoints = [{{range getEntryPoints $instance.SegmentLabels }}
2017-11-22 11:00:04 +00:00
"{{.}}",
2017-12-20 22:00:52 +00:00
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $instance.SegmentLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Issuer }}
{{if $issuer }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $auth := getAuth $instance.SegmentLabels }}
2018-07-06 14:52:04 +00:00
{{if $auth }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth]
2018-07-06 14:52:04 +00:00
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.forward]
2018-07-06 14:52:04 +00:00
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
2018-07-06 14:52:04 +00:00
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2017-12-20 22:00:52 +00:00
2018-08-27 14:32:05 +00:00
{{ $whitelist := getWhiteList $instance.SegmentLabels }}
{{if $whitelist }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
2018-08-28 13:50:00 +00:00
[frontends."frontend-{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $redirect := getRedirect $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $redirect }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".redirect]
2018-01-10 17:28:03 +00:00
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2017-12-20 22:00:52 +00:00
{{end}}
2018-08-27 14:32:05 +00:00
{{ $errorPages := getErrorPages $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $errorPages }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".errors]
2018-01-10 17:28:03 +00:00
{{range $pageName, $page := $errorPages }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-10 17:28:03 +00:00
status = [{{range $page.Status }}
2017-12-20 22:00:52 +00:00
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-10 17:28:03 +00:00
query = "{{ $page.Query }}"
2017-12-20 22:00:52 +00:00
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $rateLimit := getRateLimit $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $rateLimit }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit]
2018-01-10 17:28:03 +00:00
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
2018-01-10 17:28:03 +00:00
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 17:28:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
2017-12-20 22:00:52 +00:00
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $headers := getHeaders $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $headers }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers]
2018-01-10 17:28:03 +00:00
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-10 17:28:03 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-10 17:28:03 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
"{{.}}",
{{end}}]
2017-12-20 22:00:52 +00:00
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
2017-12-20 22:00:52 +00:00
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.CustomRequestHeaders }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers.customRequestHeaders]
2018-01-10 17:28:03 +00:00
{{range $k, $v := $headers.CustomRequestHeaders }}
2017-12-20 22:00:52 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.CustomResponseHeaders }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers.customResponseHeaders]
2018-01-10 17:28:03 +00:00
{{range $k, $v := $headers.CustomResponseHeaders }}
2017-12-20 22:00:52 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.SSLProxyHeaders }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers.SSLProxyHeaders]
2018-01-10 17:28:03 +00:00
{{range $k, $v := $headers.SSLProxyHeaders }}
2017-12-20 22:00:52 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".routes."route-frontend-{{ $frontendName }}"]
2018-03-28 22:01:35 +00:00
rule = "{{ getFrontendRule $instance }}"
2017-12-20 22:00:52 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}`)
2017-11-20 14:26:03 +00:00
func templatesEcsTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesEcsTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesEcsTmpl() (*asset, error) {
bytes, err := templatesEcsTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/ecs.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-02-13 08:20:04 +00:00
var _templatesEurekaTmpl = []byte(`[backends]
{{range $app := .Applications }}
[backends.backend-{{ $app.Name }}]
{{range $instance := .Instances }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $app.Name }}".servers."server-{{ getInstanceID $instance }}"]
2018-02-13 08:20:04 +00:00
url = "{{ getProtocol $instance }}://{{ .IpAddr }}:{{ getPort $instance }}"
weight = {{ getWeight $instance }}
{{end}}
{{end}}
[frontends]
{{range $app := .Applications }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $app.Name }}"]
2018-02-13 08:20:04 +00:00
backend = "backend-{{ $app.Name }}"
2017-11-22 11:00:04 +00:00
entryPoints = ["http"]
2018-02-13 08:20:04 +00:00
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $app.Name }}".routes."route-host{{ $app.Name }}"]
2018-02-13 08:20:04 +00:00
rule = "Host:{{ $app.Name | tolower }}"
2017-11-22 11:00:04 +00:00
{{end}}
`)
2017-11-20 14:26:03 +00:00
func templatesEurekaTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesEurekaTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesEurekaTmpl() (*asset, error) {
bytes, err := templatesEurekaTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/eureka.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-01-31 15:28:27 +00:00
var _templatesKubernetesTmpl = []byte(`[backends]
{{range $backendName, $backend := .Backends }}
[backends."{{ $backendName }}"]
{{if $backend.CircuitBreaker }}
2018-03-07 21:10:04 +00:00
[backends."{{ $backendName }}".circuitBreaker]
2018-01-31 15:28:27 +00:00
expression = "{{ $backend.CircuitBreaker.Expression }}"
{{end}}
2018-10-29 17:42:03 +00:00
{{if $backend.ResponseForwarding }}
[backends."{{ $backendName }}".responseForwarding]
flushInterval = "{{ $backend.responseForwarding.FlushInterval }}"
{{end}}
2018-01-31 15:28:27 +00:00
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $backend.LoadBalancer.Method }}"
{{if $backend.LoadBalancer.Stickiness }}
[backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $backend.LoadBalancer.Stickiness.CookieName }}"
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-31 14:32:04 +00:00
2018-01-31 15:28:27 +00:00
{{if $backend.MaxConn }}
2018-03-07 21:10:04 +00:00
[backends."{{ $backendName }}".maxConn]
2018-01-31 15:28:27 +00:00
amount = {{ $backend.MaxConn.Amount }}
extractorFunc = "{{ $backend.MaxConn.ExtractorFunc }}"
{{end}}
2018-01-31 14:32:04 +00:00
{{if $backend.Buffering }}
[backends."{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $backend.Buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $backend.Buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $backend.Buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $backend.Buffering.MemResponseBodyBytes }}
retryExpression = "{{ $backend.Buffering.RetryExpression }}"
{{end}}
2018-01-31 15:28:27 +00:00
{{range $serverName, $server := $backend.Servers }}
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
[frontends]
{{range $frontendName, $frontend := .Frontends }}
[frontends."{{ $frontendName }}"]
backend = "{{ $frontend.Backend }}"
priority = {{ $frontend.Priority }}
passHostHeader = {{ $frontend.PassHostHeader }}
passTLSCert = {{ $frontend.PassTLSCert }}
entryPoints = [{{range $frontend.EntryPoints }}
2017-11-22 11:00:04 +00:00
"{{.}}",
2018-01-31 15:28:27 +00:00
{{end}}]
2017-12-15 10:48:03 +00:00
{{if $frontend.Auth }}
[frontends."{{ $frontendName }}".auth]
headerField = "X-WebAuth-User"
{{if $frontend.Auth.Basic }}
[frontends."{{ $frontendName }}".auth.basic]
removeHeader = {{$frontend.Auth.Basic.RemoveHeader}}
users = [{{range $frontend.Auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Auth.Digest }}
[frontends."{{ $frontendName }}".auth.digest]
removeHeader = {{$frontend.Auth.Digest.RemoveHeader}}
users = [{{range $frontend.Auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Auth.Forward }}
[frontends."{{ $frontendName }}".auth.forward]
address = "{{ $frontend.Auth.Forward.Address }}"
authResponseHeaders = [{{range $frontend.Auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
trustForwardHeader = {{ $frontend.Auth.Forward.TrustForwardHeader }}
{{if $frontend.Auth.Forward.TLS }}
[frontends."{{ $frontendName }}".auth.forward.tls]
cert = """{{ $frontend.Auth.Forward.TLS.Cert }}"""
key = """{{ $frontend.Auth.Forward.TLS.Key }}"""
insecureSkipVerify = {{ $frontend.Auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{end}}
{{if $frontend.WhiteList }}
[frontends."{{ $frontendName }}".whiteList]
sourceRange = [{{range $frontend.Whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $frontend.Whitelist.IPStrategy }}
[frontends."{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $frontend.Whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $frontend.Whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-01-31 15:28:27 +00:00
{{if $frontend.Redirect }}
[frontends."{{ $frontendName }}".redirect]
entryPoint = "{{ $frontend.Redirect.EntryPoint }}"
regex = "{{ $frontend.Redirect.Regex }}"
replacement = "{{ $frontend.Redirect.Replacement }}"
permanent = {{ $frontend.Redirect.Permanent }}
2018-01-31 15:28:27 +00:00
{{end}}
{{if $frontend.Errors }}
[frontends."{{ $frontendName }}".errors]
2018-01-31 15:28:27 +00:00
{{range $pageName, $page := $frontend.Errors }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-31 15:28:27 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
backend = "{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
{{if $frontend.RateLimit }}
[frontends."{{ $frontendName }}".rateLimit]
2018-01-31 15:28:27 +00:00
extractorFunc = "{{ $frontend.RateLimit.ExtractorFunc }}"
[frontends."{{ $frontendName }}".rateLimit.rateSet]
2018-01-31 15:28:27 +00:00
{{range $limitName, $limit := $frontend.RateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-31 15:28:27 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
2017-12-15 10:48:03 +00:00
{{if $frontend.PassTLSClientCert }}
[frontends."{{ $frontendName }}".passTLSClientCert]
pem = {{ $frontend.PassTLSClientCert.PEM }}
{{ $infos := $frontend.PassTLSClientCert.Infos }}
{{if $infos }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
{{end}}
{{end}}
{{end}}
2018-01-02 13:49:11 +00:00
{{if $frontend.Headers }}
2018-01-31 15:28:27 +00:00
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $frontend.Headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $frontend.Headers.SSLTemporaryRedirect }}
SSLHost = "{{ $frontend.Headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $frontend.Headers.SSLForceHost }}
2018-01-31 15:28:27 +00:00
STSSeconds = {{ $frontend.Headers.STSSeconds }}
STSIncludeSubdomains = {{ $frontend.Headers.STSIncludeSubdomains }}
STSPreload = {{ $frontend.Headers.STSPreload }}
ForceSTSHeader = {{ $frontend.Headers.ForceSTSHeader }}
FrameDeny = {{ $frontend.Headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $frontend.Headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $frontend.Headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $frontend.Headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $frontend.Headers.CustomBrowserXSSValue }}"
2018-01-31 15:28:27 +00:00
ContentSecurityPolicy = "{{ $frontend.Headers.ContentSecurityPolicy }}"
PublicKey = "{{ $frontend.Headers.PublicKey }}"
ReferrerPolicy = "{{ $frontend.Headers.ReferrerPolicy }}"
IsDevelopment = {{ $frontend.Headers.IsDevelopment }}
{{if $frontend.Headers.AllowedHosts }}
AllowedHosts = [{{range $frontend.Headers.AllowedHosts }}
"{{.}}",
{{end}}]
2017-11-28 12:36:03 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
{{if $frontend.Headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $frontend.Headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
2017-11-28 12:36:03 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
{{if $frontend.Headers.CustomRequestHeaders }}
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $frontend.Headers.CustomRequestHeaders }}
{{ $k }} = "{{ $v }}"
{{end}}
2017-11-28 12:36:03 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
{{if $frontend.Headers.CustomResponseHeaders }}
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $frontend.Headers.CustomResponseHeaders }}
{{ $k }} = "{{ $v }}"
{{end}}
{{end}}
{{if $frontend.Headers.SSLProxyHeaders }}
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $frontend.Headers.SSLProxyHeaders }}
{{ $k }} = "{{ $v }}"
{{end}}
{{end}}
{{end}}
{{range $routeName, $route := $frontend.Routes }}
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
rule = "{{ $route.Rule }}"
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
{{end}}
2018-01-31 15:28:27 +00:00
{{range $tls := .TLS }}
2018-01-24 10:57:06 +00:00
[[tls]]
2018-01-31 15:28:27 +00:00
entryPoints = [{{range $tls.EntryPoints }}
"{{.}}",
2018-01-31 15:28:27 +00:00
{{end}}]
2018-01-24 10:57:06 +00:00
[tls.certificate]
2018-01-31 15:28:27 +00:00
certFile = """{{ $tls.Certificate.CertFile }}"""
keyFile = """{{ $tls.Certificate.KeyFile }}"""
{{end}}
`)
2017-11-20 14:26:03 +00:00
func templatesKubernetesTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesKubernetesTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesKubernetesTmpl() (*asset, error) {
bytes, err := templatesKubernetesTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/kubernetes.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2017-12-23 17:15:39 +00:00
var _templatesKvTmpl = []byte(`[backends]
{{range $backend := List .Prefix "/backends/" }}
{{ $backendName := Last $backend }}
2017-12-23 17:15:39 +00:00
{{ $circuitBreaker := getCircuitBreaker $backend }}
{{if $circuitBreaker }}
[backends."{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-23 17:15:39 +00:00
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $backend }}
{{if $responseForwarding }}
[backends."{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.flushInterval }}"
{{end}}
2017-11-22 11:00:04 +00:00
{{ $loadBalancer := getLoadBalancer $backend }}
{{if $loadBalancer }}
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
{{end}}
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{ $maxConn := getMaxConn $backend }}
{{if $maxConn }}
[backends."{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-23 17:15:39 +00:00
{{end}}
{{ $healthCheck := getHealthCheck $backend }}
{{if $healthCheck }}
[backends."{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."{{ $backendName }}".healthCheck.headers]
2018-04-16 09:40:03 +00:00
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-23 17:15:39 +00:00
{{end}}
2018-01-31 14:32:04 +00:00
{{ $buffering := getBuffering $backend }}
{{if $buffering }}
[backends."{{ $backendName }}".buffering]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
{{range $serverName, $server := getServers $backend}}
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-23 17:15:39 +00:00
[frontends]
{{range $frontend := List .Prefix "/frontends/" }}
{{ $frontendName := Last $frontend }}
2017-12-23 17:15:39 +00:00
[frontends."{{ $frontendName }}"]
backend = "{{ getBackendName $frontend }}"
priority = {{ getPriority $frontend }}
passHostHeader = {{ getPassHostHeader $frontend }}
passTLSCert = {{ getPassTLSCert $frontend }}
2017-12-23 17:15:39 +00:00
entryPoints = [{{range getEntryPoints $frontend }}
2017-11-22 11:00:04 +00:00
"{{.}}",
2017-12-23 17:15:39 +00:00
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $frontend }}
{{if $tlsClientCert }}
[frontends."{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
{{ $auth := getAuth $frontend }}
{{if $auth }}
[frontends."{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2018-01-03 15:57:34 +00:00
{{ $whitelist := getWhiteList $frontend }}
{{if $whitelist }}
[frontends."{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
{{ $redirect := getRedirect $frontend }}
{{if $redirect }}
[frontends."{{ $frontendName }}".redirect]
2018-01-03 15:57:34 +00:00
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2018-01-03 15:57:34 +00:00
{{end}}
{{ $errorPages := getErrorPages $frontend }}
{{if $errorPages }}
[frontends."{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."{{$frontendName}}".errors."{{ $pageName }}"]
status = [{{range $page.Status }}
2018-01-03 15:57:34 +00:00
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ $rateLimit := getRateLimit $frontend }}
{{if $rateLimit }}
[frontends."{{ $frontendName }}".rateLimit]
2018-01-03 15:57:34 +00:00
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."{{ $frontendName }}".rateLimit.rateSet]
{{range $limitName, $rateLimit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-03 15:57:34 +00:00
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
{{ $headers := getHeaders $frontend }}
{{if $headers }}
2018-01-03 15:57:34 +00:00
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-03 15:57:34 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-03 15:57:34 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
2018-01-03 15:57:34 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
2018-01-03 15:57:34 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $headers.CustomRequestHeaders }}
2018-01-03 15:57:34 +00:00
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
2018-01-03 15:57:34 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.CustomResponseHeaders }}
2018-01-03 15:57:34 +00:00
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
2018-01-03 15:57:34 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.SSLProxyHeaders }}
2018-01-03 15:57:34 +00:00
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
{{range $routeName, $route := getRoutes $frontend }}
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
rule = "{{ $route.Rule }}"
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-24 10:57:06 +00:00
{{range $tls := getTLSSection .Prefix }}
2018-01-23 15:30:07 +00:00
[[tls]]
2017-12-23 17:15:39 +00:00
2018-01-24 10:57:06 +00:00
entryPoints = [{{range $tls.EntryPoints }}
2017-12-23 17:15:39 +00:00
"{{.}}",
{{end}}]
2018-01-24 10:57:06 +00:00
[tls.certificate]
certFile = """{{ $tls.Certificate.CertFile }}"""
keyFile = """{{ $tls.Certificate.KeyFile }}"""
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
`)
2017-11-20 14:26:03 +00:00
func templatesKvTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesKvTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesKvTmpl() (*asset, error) {
bytes, err := templatesKvTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/kv.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-01-10 10:58:03 +00:00
var _templatesMarathonTmpl = []byte(`{{ $apps := .Applications }}
2017-11-22 11:00:04 +00:00
2017-12-20 16:27:54 +00:00
[backends]
{{range $backendName, $app := $apps }}
2017-12-20 16:27:54 +00:00
2018-01-10 10:58:03 +00:00
[backends."{{ $backendName }}"]
2017-12-20 16:27:54 +00:00
2018-03-26 13:32:04 +00:00
{{ $circuitBreaker := getCircuitBreaker $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $circuitBreaker }}
[backends."{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-20 16:27:54 +00:00
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $app.SegmentLabels }}
{{if $responseForwarding }}
[backends."{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2017-12-20 16:27:54 +00:00
2018-03-26 13:32:04 +00:00
{{ $loadBalancer := getLoadBalancer $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $loadBalancer }}
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
2017-12-20 16:27:54 +00:00
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $maxConn := getMaxConn $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $maxConn }}
[backends."{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-20 16:27:54 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $healthCheck := getHealthCheck $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $healthCheck }}
[backends."{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-10 10:58:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends.{{ $backendName }}.healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-20 16:27:54 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $buffering := getBuffering $app.SegmentLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
[backends."{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-03-26 13:32:04 +00:00
{{range $serverName, $server := getServers $app }}
2018-01-10 10:58:03 +00:00
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-12-20 16:27:54 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 16:27:54 +00:00
[frontends]
{{range $backendName, $app := $apps }}
2018-03-26 13:32:04 +00:00
{{ $frontendName := getFrontendName $app }}
2017-11-22 11:00:04 +00:00
2018-01-10 10:58:03 +00:00
[frontends."{{ $frontendName }}"]
backend = "{{ $backendName }}"
2018-03-26 13:32:04 +00:00
priority = {{ getPriority $app.SegmentLabels }}
passHostHeader = {{ getPassHostHeader $app.SegmentLabels }}
passTLSCert = {{ getPassTLSCert $app.SegmentLabels }}
2017-12-20 16:27:54 +00:00
2018-03-26 13:32:04 +00:00
entryPoints = [{{range getEntryPoints $app.SegmentLabels }}
2017-12-20 16:27:54 +00:00
"{{.}}",
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $app.SegmentLabels }}
{{if $tlsClientCert }}
[frontends."{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
{{ $auth := getAuth $app.SegmentLabels }}
2018-07-06 14:52:04 +00:00
{{if $auth }}
[frontends."{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2017-12-20 16:27:54 +00:00
2018-03-26 13:32:04 +00:00
{{ $whitelist := getWhiteList $app.SegmentLabels }}
{{if $whitelist }}
[frontends."{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $redirect := getRedirect $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $redirect }}
[frontends."{{ $frontendName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2017-12-20 16:27:54 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $errorPages := getErrorPages $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $errorPages }}
[frontends."{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-10 10:58:03 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend{{ $page.Backend }}"
2018-01-10 10:58:03 +00:00
query = "{{ $page.Query }}"
2017-12-20 16:27:54 +00:00
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $rateLimit := getRateLimit $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $rateLimit }}
[frontends."{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."{{ $frontendName }}".rateLimit.rateSet]
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 10:58:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
2017-12-20 16:27:54 +00:00
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $headers := getHeaders $app.SegmentLabels }}
2018-01-10 10:58:03 +00:00
{{if $headers }}
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-10 10:58:03 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-10 10:58:03 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
2018-01-02 08:42:03 +00:00
2018-01-10 10:58:03 +00:00
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
"{{.}}",
{{end}}]
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-10 10:58:03 +00:00
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-10 10:58:03 +00:00
{{if $headers.CustomRequestHeaders }}
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
{{$k}} = "{{$v}}"
{{end}}
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-10 10:58:03 +00:00
{{if $headers.CustomResponseHeaders }}
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
{{$k}} = "{{$v}}"
{{end}}
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
2018-01-10 10:58:03 +00:00
{{if $headers.SSLProxyHeaders }}
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders }}
{{$k}} = "{{$v}}"
{{end}}
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
{{end}}
2017-12-20 16:27:54 +00:00
2018-03-26 13:32:04 +00:00
[frontends."{{ $frontendName }}".routes."route-host{{ $app.ID | replace "/" "-" }}{{ getSegmentNameSuffix $app.SegmentName }}"]
rule = "{{ getFrontendRule $app }}"
2017-12-20 16:27:54 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
`)
2017-11-20 14:26:03 +00:00
func templatesMarathonTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesMarathonTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesMarathonTmpl() (*asset, error) {
bytes, err := templatesMarathonTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/marathon.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-01-10 20:57:05 +00:00
var _templatesMesosTmpl = []byte(`[backends]
{{range $applicationName, $tasks := .ApplicationsTasks }}
{{ $app := index $tasks 0 }}
{{ $backendName := getBackendName $app }}
2017-11-22 11:00:04 +00:00
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}"]
2018-01-10 20:57:05 +00:00
2018-03-28 22:01:35 +00:00
{{ $circuitBreaker := getCircuitBreaker $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $circuitBreaker }}
[backends."backend-{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
{{end}}
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $app.TraefikLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-03-28 22:01:35 +00:00
{{ $loadBalancer := getLoadBalancer $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $loadBalancer }}
[backends."backend-{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $maxConn := getMaxConn $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $maxConn }}
[backends."backend-{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $healthCheck := getHealthCheck $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-10 20:57:05 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $backendName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-10 20:57:05 +00:00
{{end}}
2018-03-28 22:01:35 +00:00
{{ $buffering := getBuffering $app.TraefikLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".buffering]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-01-10 20:57:05 +00:00
{{range $serverName, $server := getServers $tasks }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".servers."{{ $serverName }}"]
2018-01-10 20:57:05 +00:00
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-10 20:57:05 +00:00
[frontends]
{{range $applicationName, $tasks := .ApplicationsTasks }}
{{ $app := index $tasks 0 }}
{{ $frontendName := getFrontEndName $app }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}"]
2018-01-10 20:57:05 +00:00
backend = "backend-{{ getBackendName $app }}"
2018-03-28 22:01:35 +00:00
priority = {{ getPriority $app.TraefikLabels }}
passHostHeader = {{ getPassHostHeader $app.TraefikLabels }}
passTLSCert = {{ getPassTLSCert $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
2018-03-28 22:01:35 +00:00
entryPoints = [{{range getEntryPoints $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
"{{.}}",
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $app.TraefikLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
{{ $auth := getAuth $app.TraefikLabels }}
{{if $auth }}
[frontends."frontend-{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."frontend-{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."frontend-{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader}}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
2018-01-10 20:57:05 +00:00
2018-07-06 14:52:04 +00:00
{{if $auth.Digest }}
[frontends."frontend-{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader}}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $whitelist := getWhiteList $app.TraefikLabels }}
{{if $whitelist }}
[frontends."frontend-{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."frontend-{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $redirect := getRedirect $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $redirect }}
[frontends."frontend-{{ $frontendName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2018-01-10 20:57:05 +00:00
{{end}}
2018-03-28 22:01:35 +00:00
{{ $errorPages := getErrorPages $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $errorPages }}
[frontends."frontend-{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-10 20:57:05 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-10 20:57:05 +00:00
query = "{{ $page.Query }}"
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $rateLimit := getRateLimit $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $rateLimit }}
[frontends."frontend-{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 20:57:05 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
2018-03-28 22:01:35 +00:00
{{ $headers := getHeaders $app.TraefikLabels }}
2018-01-10 20:57:05 +00:00
{{if $headers }}
[frontends."frontend-{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-10 20:57:05 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-10 20:57:05 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
"{{.}}",
{{end}}]
{{end}}
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
{{end}}
{{if $headers.CustomRequestHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.CustomResponseHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.SSLProxyHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".routes."route-host-{{ $frontendName }}"]
2018-01-10 20:57:05 +00:00
rule = "{{ getFrontendRule $app }}"
{{end}}`)
2017-11-20 14:26:03 +00:00
func templatesMesosTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesMesosTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesMesosTmpl() (*asset, error) {
bytes, err := templatesMesosTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/mesos.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2017-11-22 11:00:04 +00:00
var _templatesNotfoundTmpl = []byte(`<!DOCTYPE html>
<html>
<head>
<title>Traefik</title>
</head>
<body>
Ohhhh man, this is bad...
</body>
</html>`)
2017-11-20 14:26:03 +00:00
func templatesNotfoundTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesNotfoundTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesNotfoundTmpl() (*asset, error) {
bytes, err := templatesNotfoundTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/notFound.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
2018-01-10 17:08:03 +00:00
var _templatesRancherTmpl = []byte(`{{ $backendServers := .Backends }}
2017-12-20 15:48:30 +00:00
[backends]
2018-01-10 17:08:03 +00:00
{{range $backendName, $backend := .Backends }}
2017-11-22 11:00:04 +00:00
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}"]
2017-11-22 11:00:04 +00:00
2018-03-26 13:32:04 +00:00
{{ $circuitBreaker := getCircuitBreaker $backend.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $circuitBreaker }}
[backends."backend-{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-20 15:48:30 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
2018-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $backend.SegmentLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $backendName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-03-26 13:32:04 +00:00
{{ $loadBalancer := getLoadBalancer $backend.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $loadBalancer }}
[backends."backend-{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $maxConn := getMaxConn $backend.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $maxConn }}
[backends."backend-{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-20 15:48:30 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $healthCheck := getHealthCheck $backend.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-10 17:08:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-09-27 18:16:03 +00:00
timeout = "{{ $healthCheck.Timeout }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $backendName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $buffering := getBuffering $backend.SegmentLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
[backends."backend-{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-01-10 17:08:03 +00:00
{{range $serverName, $server := getServers $backend}}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $backendName }}".servers."{{ $serverName }}"]
2018-01-10 17:08:03 +00:00
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-12-20 15:48:30 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 15:48:30 +00:00
[frontends]
2018-01-10 17:08:03 +00:00
{{range $frontendName, $service := .Frontends }}
2017-12-20 15:48:30 +00:00
2018-01-10 17:08:03 +00:00
[frontends."frontend-{{ $frontendName }}"]
backend = "backend-{{ getBackendName $service }}"
2018-03-26 13:32:04 +00:00
priority = {{ getPriority $service.SegmentLabels }}
passHostHeader = {{ getPassHostHeader $service.SegmentLabels }}
passTLSCert = {{ getPassTLSCert $service.SegmentLabels }}
2017-12-20 15:48:30 +00:00
2018-03-26 13:32:04 +00:00
entryPoints = [{{range getEntryPoints $service.SegmentLabels }}
2017-12-20 15:48:30 +00:00
"{{.}}",
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $service.SegmentLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
domainComponent = {{ $subject.DomainComponent }}
{{end}}
{{ $issuer := $infos.Subject }}
{{if $issuer }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.issuer]
country = {{ $issuer.Country }}
province = {{ $issuer.Province }}
locality = {{ $issuer.Locality }}
organization = {{ $issuer.Organization }}
commonName = {{ $issuer.CommonName }}
serialNumber = {{ $issuer.SerialNumber }}
domainComponent = {{ $issuer.DomainComponent }}
2018-08-29 09:36:03 +00:00
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
{{ $auth := getAuth $service.SegmentLabels }}
{{if $auth }}
[frontends."frontend-{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."frontend-{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."frontend-{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."frontend-{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2017-12-15 10:48:03 +00:00
2018-03-26 13:32:04 +00:00
{{ $whitelist := getWhiteList $service.SegmentLabels }}
{{if $whitelist }}
[frontends."frontend-{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."frontend-{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $redirect := getRedirect $service.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $redirect }}
[frontends."frontend-{{ $frontendName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
2017-12-15 10:48:03 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $errorPages := getErrorPages $service.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $errorPages }}
[frontends."frontend-{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-10 17:08:03 +00:00
status = [{{range $page.Status }}
2017-12-20 15:48:30 +00:00
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-10 17:08:03 +00:00
query = "{{ $page.Query }}"
2017-12-20 15:48:30 +00:00
{{end}}
{{end}}
2018-03-26 13:32:04 +00:00
{{ $rateLimit := getRateLimit $service.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $rateLimit }}
[frontends."frontend-{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 17:08:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
2018-03-26 13:32:04 +00:00
{{ $headers := getHeaders $service.SegmentLabels }}
2018-01-10 17:08:03 +00:00
{{if $headers }}
[frontends."frontend-{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-10 17:08:03 +00:00
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-10 17:08:03 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
2017-12-20 15:48:30 +00:00
2018-01-10 17:08:03 +00:00
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
"{{.}}",
{{end}}]
{{end}}
2017-12-20 15:48:30 +00:00
2018-01-10 17:08:03 +00:00
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
2017-12-20 15:48:30 +00:00
{{end}}
2018-01-10 17:08:03 +00:00
{{if $headers.CustomRequestHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
{{$k}} = "{{$v}}"
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
2018-01-10 17:08:03 +00:00
{{if $headers.CustomResponseHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $headers.CustomResponseHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if $headers.SSLProxyHeaders }}
[frontends."frontend-{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders }}
{{$k}} = "{{$v}}"
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
{{end}}
2018-03-28 15:18:04 +00:00
[frontends."frontend-{{ $frontendName }}".routes."route-frontend-{{ $frontendName }}"]
rule = "{{ getFrontendRule $service.Name $service.SegmentLabels }}"
2017-12-20 15:48:30 +00:00
2017-11-22 11:00:04 +00:00
{{end}}
`)
2017-11-20 14:26:03 +00:00
func templatesRancherTmplBytes() ([]byte, error) {
2017-11-22 11:00:04 +00:00
return _templatesRancherTmpl, nil
2017-11-20 14:26:03 +00:00
}
func templatesRancherTmpl() (*asset, error) {
bytes, err := templatesRancherTmplBytes()
if err != nil {
return nil, err
}
2017-11-22 11:00:04 +00:00
info := bindataFileInfo{name: "templates/rancher.tmpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
2017-11-20 14:26:03 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
2018-07-23 09:56:02 +00:00
"templates/consul_catalog.tmpl": templatesConsul_catalogTmpl,
"templates/docker.tmpl": templatesDockerTmpl,
"templates/ecs.tmpl": templatesEcsTmpl,
"templates/eureka.tmpl": templatesEurekaTmpl,
"templates/kubernetes.tmpl": templatesKubernetesTmpl,
"templates/kv.tmpl": templatesKvTmpl,
"templates/marathon.tmpl": templatesMarathonTmpl,
"templates/mesos.tmpl": templatesMesosTmpl,
"templates/notFound.tmpl": templatesNotfoundTmpl,
"templates/rancher.tmpl": templatesRancherTmpl,
2017-11-20 14:26:03 +00:00
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
rv = append(rv, childName)
}
return rv, nil
}
type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
2017-11-21 20:30:03 +00:00
2017-11-20 14:26:03 +00:00
var _bintree = &bintree{nil, map[string]*bintree{
2017-11-30 07:52:03 +00:00
"templates": {nil, map[string]*bintree{
2018-07-23 09:56:02 +00:00
"consul_catalog.tmpl": {templatesConsul_catalogTmpl, map[string]*bintree{}},
"docker.tmpl": {templatesDockerTmpl, map[string]*bintree{}},
"ecs.tmpl": {templatesEcsTmpl, map[string]*bintree{}},
"eureka.tmpl": {templatesEurekaTmpl, map[string]*bintree{}},
"kubernetes.tmpl": {templatesKubernetesTmpl, map[string]*bintree{}},
"kv.tmpl": {templatesKvTmpl, map[string]*bintree{}},
"marathon.tmpl": {templatesMarathonTmpl, map[string]*bintree{}},
"mesos.tmpl": {templatesMesosTmpl, map[string]*bintree{}},
"notFound.tmpl": {templatesNotfoundTmpl, map[string]*bintree{}},
"rancher.tmpl": {templatesRancherTmpl, map[string]*bintree{}},
2017-11-20 14:26:03 +00:00
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}