traefik/autogen/gentemplates/gen.go

1662 lines
55 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}}
2017-11-22 11:00:04 +00:00
2018-01-02 19:02:20 +00:00
{{ $circuitBreaker := getCircuitBreaker $service.Attributes }}
{{if $circuitBreaker }}
[backends."backend-{{ getServiceBackendName $service }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-02 19:02:20 +00:00
{{ $loadBalancer := getLoadBalancer $service.Attributes }}
{{if $loadBalancer }}
[backends."backend-{{ getServiceBackendName $service }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
sticky = {{ $loadBalancer.Sticky }}
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ getServiceBackendName $service }}".loadBalancer.stickiness]
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-01-02 19:02:20 +00:00
{{ $maxConn := getMaxConn $service.Attributes }}
{{if $maxConn }}
[backends."backend-{{ getServiceBackendName $service }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-11-22 11:00:04 +00:00
{{end}}
2018-01-02 19:02:20 +00:00
{{ $healthCheck := getHealthCheck $service.Attributes }}
{{if $healthCheck }}
[backends.backend-{{ getServiceBackendName $service }}.healthCheck]
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
{{end}}
{{end}}
{{range $index, $node := .Nodes}}
[backends."backend-{{ getNodeBackendName $node }}".servers."{{ getServerName $node $index }}"]
url = "{{ getProtocol $node.Service.Tags }}://{{ getBackendAddress $node }}:{{ $node.Service.Port }}"
weight = {{ getWeight $node.Service.Tags }}
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 }}"
priority = {{ getPriority $service.Attributes }}
passHostHeader = {{ getPassHostHeader $service.Attributes }}
passTLSCert = {{ getPassTLSCert $service.Attributes }}
entryPoints = [{{range getFrontEndEntryPoints $service.Attributes }}
2017-11-22 11:00:04 +00:00
"{{.}}",
2018-01-02 19:02:20 +00:00
{{end}}]
{{ $whitelistSourceRange := getWhitelistSourceRange $service.Attributes }}
{{if $whitelistSourceRange }}
whitelistSourceRange = [{{range $whitelistSourceRange}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth $service.Attributes }}
"{{.}}",
{{end}}]
{{ $redirect := getRedirect $service.Attributes }}
{{if $redirect }}
[frontends."frontend-{{ $service.ServiceName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
{{end}}
{{ if hasErrorPages $service.Attributes }}
[frontends."frontend-{{ $service.ServiceName }}".errors]
{{ range $pageName, $page := getErrorPages $service.Attributes }}
[frontends."frontend-{{ $service.ServiceName }}".errors.{{ $pageName }}]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
backend = "{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
{{ if hasRateLimit $service.Attributes }}
{{ $rateLimit := getRateLimit $service.Attributes }}
[frontends."frontend-{{ $service.ServiceName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $service.ServiceName }}".rateLimit.rateSet]
{{ range $limitName, $limit := $rateLimit.RateSet }}
[frontends."frontend-{{ $service.ServiceName }}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
{{ $headers := getHeaders $service.Attributes }}
{{ if $headers }}
[frontends."frontend-{{ $service.ServiceName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
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 }}"
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-{{ $service.ServiceName }}".headers.customRequestHeaders]
{{ range $k, $v := $headers.CustomRequestHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{ if $headers.CustomResponseHeaders }}
[frontends."frontend-{{ $service.ServiceName }}".headers.customResponseHeaders]
{{ range $k, $v := $headers.CustomResponseHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{ if $headers.SSLProxyHeaders }}
[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
}
2017-11-22 11:00:04 +00:00
var _templatesDockerTmpl = []byte(`{{$backendServers := .Servers}}
2017-12-19 23:52:56 +00:00
[backends]
{{range $backendName, $backend := .Backends}}
2017-11-22 11:00:04 +00:00
2017-12-19 23:52:56 +00:00
{{if hasCircuitBreakerLabel $backend}}
[backends.backend-{{$backendName}}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $backend}}"
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-19 23:52:56 +00:00
{{if hasLoadBalancerLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer]
method = "{{getLoadBalancerMethod $backend}}"
sticky = {{getSticky $backend}}
{{if hasStickinessLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
{{end}}
{{if hasMaxConnLabels $backend}}
[backends.backend-{{$backendName}}.maxConn]
amount = {{getMaxConnAmount $backend}}
extractorFunc = "{{getMaxConnExtractorFunc $backend}}"
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-19 23:52:56 +00:00
{{if hasHealthCheckLabels $backend}}
[backends.backend-{{$backendName}}.healthCheck]
path = "{{getHealthCheckPath $backend}}"
port = {{getHealthCheckPort $backend}}
interval = "{{getHealthCheckInterval $backend}}"
{{end}}
{{$servers := index $backendServers $backendName}}
{{range $serverName, $server := $servers}}
2017-11-22 11:00:04 +00:00
{{if hasServices $server}}
{{$services := getServiceNames $server}}
{{range $serviceIndex, $serviceName := $services}}
[backends.backend-{{getServiceBackend $server $serviceName}}.servers.service-{{$serverName}}]
2017-12-19 23:52:56 +00:00
url = "{{getServiceProtocol $server $serviceName}}://{{getIPAddress $server}}:{{getServicePort $server $serviceName}}"
weight = {{getServiceWeight $server $serviceName}}
2017-11-22 11:00:04 +00:00
{{end}}
{{else}}
[backends.backend-{{$backendName}}.servers.server-{{$server.Name | replace "/" "" | replace "." "-"}}]
2017-12-19 23:52:56 +00:00
url = "{{getProtocol $server}}://{{getIPAddress $server}}:{{getPort $server}}"
weight = {{getWeight $server}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
[frontends]
{{range $frontend, $containers := .Frontends}}
2017-11-22 11:00:04 +00:00
{{$container := index $containers 0}}
2017-12-19 23:52:56 +00:00
2017-11-22 11:00:04 +00:00
{{if hasServices $container}}
{{$services := getServiceNames $container}}
2017-12-19 23:52:56 +00:00
2017-11-22 11:00:04 +00:00
{{range $serviceIndex, $serviceName := $services}}
[frontends."frontend-{{getServiceBackend $container $serviceName}}"]
2017-12-19 23:52:56 +00:00
backend = "backend-{{getServiceBackend $container $serviceName}}"
priority = {{getServicePriority $container $serviceName}}
passHostHeader = {{getServicePassHostHeader $container $serviceName}}
passTLSCert = {{getServicePassTLSCert $container $serviceName}}
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
2017-11-22 11:00:04 +00:00
"{{.}}",
2017-12-19 23:52:56 +00:00
{{end}}]
2017-12-15 10:48:03 +00:00
2017-12-19 23:52:56 +00:00
{{if getServiceWhitelistSourceRange $container $serviceName}}
whitelistSourceRange = [{{range getServiceWhitelistSourceRange $container $serviceName}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getServiceBasicAuth $container $serviceName}}
"{{.}}",
{{end}}]
{{if hasServiceRedirect $container $serviceName}}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".redirect]
entryPoint = "{{getServiceRedirectEntryPoint $container $serviceName}}"
regex = "{{getServiceRedirectRegex $container $serviceName}}"
replacement = "{{getServiceRedirectReplacement $container $serviceName}}"
{{end}}
{{ if hasServiceErrorPages $container $serviceName }}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".errors]
{{ range $pageName, $page := getServiceErrorPages $container $serviceName }}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".errors.{{$pageName}}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ if hasServiceRateLimits $container $serviceName }}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $container $serviceName }}"
[frontends."frontend-{{getServiceBackend $container $serviceName}}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getServiceRateLimits $container $serviceName }}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
2017-12-15 10:48:03 +00:00
[frontends."frontend-{{getServiceBackend $container $serviceName}}".routes."service-{{$serviceName | replace "/" "" | replace "." "-"}}"]
2017-11-22 11:00:04 +00:00
rule = "{{getServiceFrontendRule $container $serviceName}}"
2017-12-19 23:52:56 +00:00
{{if hasServiceRequestHeaders $container $serviceName}}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".headers.customRequestHeaders]
{{range $k, $v := getServiceRequestHeaders $container $serviceName}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-19 23:52:56 +00:00
{{if hasServiceResponseHeaders $container $serviceName}}
[frontends."frontend-{{getServiceBackend $container $serviceName}}".headers.customResponseHeaders]
{{range $k, $v := getServiceResponseHeaders $container $serviceName}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-19 23:52:56 +00:00
{{end}} ## end range services
2017-11-22 11:00:04 +00:00
{{else}}
2017-12-19 23:52:56 +00:00
2017-11-22 11:00:04 +00:00
[frontends."frontend-{{$frontend}}"]
2017-12-19 23:52:56 +00:00
backend = "backend-{{getBackend $container}}"
priority = {{getPriority $container}}
passHostHeader = {{getPassHostHeader $container}}
passTLSCert = {{getPassTLSCert $container}}
entryPoints = [{{range getEntryPoints $container}}
"{{.}}",
{{end}}]
{{if getWhitelistSourceRange $container}}
2017-11-22 11:00:04 +00:00
whitelistSourceRange = [{{range getWhitelistSourceRange $container}}
"{{.}}",
2017-12-19 23:52:56 +00:00
{{end}}]
{{end}}
2017-12-15 10:48:03 +00:00
2017-12-19 23:52:56 +00:00
basicAuth = [{{range getBasicAuth $container}}
"{{.}}",
{{end}}]
2017-12-15 10:48:03 +00:00
2017-12-19 23:52:56 +00:00
{{if hasRedirect $container}}
[frontends."frontend-{{$frontend}}".redirect]
entryPoint = "{{getRedirectEntryPoint $container}}"
regex = "{{getRedirectRegex $container}}"
replacement = "{{getRedirectReplacement $container}}"
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
{{ if hasErrorPages $container }}
[frontends."frontend-{{$frontend}}".errors]
{{ range $pageName, $page := getErrorPages $container }}
[frontends."frontend-{{$frontend}}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
{{ if hasRateLimits $container }}
[frontends."frontend-{{$frontend}}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $container }}"
[frontends."frontend-{{$frontend}}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getRateLimits $container }}
[frontends."frontend-{{$frontend}}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2018-01-02 13:49:11 +00:00
{{ if hasHeaders $container}}
2017-12-19 23:52:56 +00:00
[frontends."frontend-{{$frontend}}".headers]
{{if hasSSLRedirectHeaders $container}}
SSLRedirect = {{getSSLRedirectHeaders $container}}
{{end}}
{{if hasSSLTemporaryRedirectHeaders $container}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $container}}
{{end}}
{{if hasSSLHostHeaders $container}}
SSLHost = "{{getSSLHostHeaders $container}}"
{{end}}
{{if hasSTSSecondsHeaders $container}}
STSSeconds = {{getSTSSecondsHeaders $container}}
{{end}}
{{if hasSTSIncludeSubdomainsHeaders $container}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $container}}
{{end}}
{{if hasSTSPreloadHeaders $container}}
STSPreload = {{getSTSPreloadHeaders $container}}
{{end}}
{{if hasForceSTSHeaderHeaders $container}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $container}}
{{end}}
{{if hasFrameDenyHeaders $container}}
FrameDeny = {{getFrameDenyHeaders $container}}
{{end}}
{{if hasCustomFrameOptionsValueHeaders $container}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $container}}"
{{end}}
{{if hasContentTypeNosniffHeaders $container}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders $container}}
{{end}}
{{if hasBrowserXSSFilterHeaders $container}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $container}}
{{end}}
{{if hasContentSecurityPolicyHeaders $container}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $container}}"
{{end}}
{{if hasPublicKeyHeaders $container}}
PublicKey = "{{getPublicKeyHeaders $container}}"
{{end}}
{{if hasReferrerPolicyHeaders $container}}
ReferrerPolicy = "{{getReferrerPolicyHeaders $container}}"
{{end}}
{{if hasIsDevelopmentHeaders $container}}
IsDevelopment = {{getIsDevelopmentHeaders $container}}
{{end}}
2018-01-02 08:42:03 +00:00
{{if hasAllowedHostsHeaders $container}}
AllowedHosts = [{{range getAllowedHostsHeaders $container}}
"{{.}}",
{{end}}]
{{end}}
{{if hasHostsProxyHeaders $container}}
HostsProxyHeaders = [{{range getHostsProxyHeaders $container}}
"{{.}}",
{{end}}]
{{end}}
2017-12-19 23:52:56 +00:00
{{if hasRequestHeaders $container}}
[frontends."frontend-{{$frontend}}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $container}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 08:42:03 +00:00
2017-12-19 23:52:56 +00:00
{{if hasResponseHeaders $container}}
[frontends."frontend-{{$frontend}}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $container}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 08:42:03 +00:00
2017-12-19 23:52:56 +00:00
{{if hasSSLProxyHeaders $container}}
[frontends."frontend-{{$frontend}}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $container}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-11-22 18:40:04 +00:00
{{end}}
2017-12-19 23:52:56 +00:00
2017-11-22 11:00:04 +00:00
[frontends."frontend-{{$frontend}}".routes."route-frontend-{{$frontend}}"]
2017-12-19 23:52:56 +00:00
rule = "{{getFrontendRule $container}}"
2017-11-22 11:00:04 +00:00
{{end}}
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]
{{range $serviceName, $instances := .Services}}
{{if hasCircuitBreakerLabel $instances}}
[backends.backend-{{ $serviceName }}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $instances}}"
{{end}}
{{if hasLoadBalancerLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer]
2017-11-22 11:00:04 +00:00
method = "{{ getLoadBalancerMethod $instances}}"
sticky = {{ getSticky $instances}}
2017-12-20 22:00:52 +00:00
{{if hasStickinessLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer.stickiness]
2017-11-22 11:00:04 +00:00
cookieName = "{{getStickinessCookieName $instances}}"
{{end}}
2017-12-20 22:00:52 +00:00
{{end}}
{{if hasMaxConnLabels $instances}}
[backends.backend-{{ $serviceName }}.maxConn]
amount = {{getMaxConnAmount $instances}}
extractorFunc = "{{getMaxConnExtractorFunc $instances}}"
{{end}}
{{ if hasHealthCheckLabels $instances }}
[backends.backend-{{ $serviceName }}.healthCheck]
path = "{{getHealthCheckPath $instances }}"
port = {{getHealthCheckPort $instances}}
interval = "{{getHealthCheckInterval $instances }}"
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-20 22:00:52 +00:00
{{range $index, $instance := $instances}}
[backends.backend-{{ $instance.Name }}.servers.server-{{ $instance.Name }}{{ $instance.ID }}]
url = "{{ getProtocol $instance }}://{{ getHost $instance }}:{{ getPort $instance }}"
weight = {{ getWeight $instance}}
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]
{{range $serviceName, $instances := .Services}}
{{range $instance := filterFrontends $instances}}
[frontends.frontend-{{ $serviceName }}]
backend = "backend-{{ $serviceName }}"
priority = {{ getPriority $instance}}
passHostHeader = {{ getPassHostHeader $instance}}
passTLSCert = {{ getPassTLSCert $instance}}
entryPoints = [{{range getEntryPoints $instance}}
2017-11-22 11:00:04 +00:00
"{{.}}",
2017-12-20 22:00:52 +00:00
{{end}}]
{{if getWhitelistSourceRange $instance}}
whitelistSourceRange = [{{range getWhitelistSourceRange $instance}}
2017-11-22 11:00:04 +00:00
"{{.}}",
2017-12-20 22:00:52 +00:00
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth $instance}}
"{{.}}",
{{end}}]
{{if hasRedirect $instance}}
[frontends."frontend-{{ $serviceName }}".redirect]
entryPoint = "{{getRedirectEntryPoint $instance}}"
regex = "{{getRedirectRegex $instance}}"
replacement = "{{getRedirectReplacement $instance}}"
{{end}}
{{ if hasErrorPages $instance }}
[frontends."frontend-{{ $serviceName }}".errors]
{{ range $pageName, $page := getErrorPages $instance }}
[frontends."frontend-{{ $serviceName }}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ if hasRateLimits $instance }}
[frontends."frontend-{{ $serviceName }}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $instance }}"
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getRateLimits $instance }}
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
{{if hasHeaders $instance }}
[frontends."frontend-{{ $serviceName }}".headers]
{{if hasSSLRedirectHeaders $instance}}
SSLRedirect = {{getSSLRedirectHeaders $instance}}
{{end}}
{{if hasSSLTemporaryRedirectHeaders $instance}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $instance}}
{{end}}
{{if hasSSLHostHeaders $instance}}
SSLHost = "{{getSSLHostHeaders $instance}}"
{{end}}
{{if hasSTSSecondsHeaders $instance}}
STSSeconds = {{getSTSSecondsHeaders $instance}}
{{end}}
{{if hasSTSIncludeSubdomainsHeaders $instance}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $instance}}
{{end}}
{{if hasSTSPreloadHeaders $instance}}
STSPreload = {{getSTSPreloadHeaders $instance}}
{{end}}
{{if hasForceSTSHeaderHeaders $instance}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $instance}}
{{end}}
{{if hasFrameDenyHeaders $instance}}
FrameDeny = {{getFrameDenyHeaders $instance}}
{{end}}
{{if hasCustomFrameOptionsValueHeaders $instance}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $instance}}"
{{end}}
{{if hasContentTypeNosniffHeaders $instance}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders $instance}}
{{end}}
{{if hasBrowserXSSFilterHeaders $instance}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $instance}}
{{end}}
{{if hasContentSecurityPolicyHeaders $instance}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $instance}}"
{{end}}
{{if hasPublicKeyHeaders $instance}}
PublicKey = "{{getPublicKeyHeaders $instance}}"
{{end}}
{{if hasReferrerPolicyHeaders $instance}}
ReferrerPolicy = "{{getReferrerPolicyHeaders $instance}}"
{{end}}
{{if hasIsDevelopmentHeaders $instance}}
IsDevelopment = {{getIsDevelopmentHeaders $instance}}
{{end}}
{{if hasRequestHeaders $instance}}
[frontends."frontend-{{ $serviceName }}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $instance}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasResponseHeaders $instance}}
[frontends."frontend-{{ $serviceName }}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $instance}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasAllowedHostsHeaders $instance}}
[frontends."frontend-{{ $serviceName }}".headers.AllowedHosts]
{{range getAllowedHostsHeaders $instance}}
"{{.}}"
{{end}}
{{end}}
{{if hasHostsProxyHeaders $instance}}
[frontends."frontend-{{ $serviceName }}".headers.HostsProxyHeaders]
{{range getHostsProxyHeaders $instance}}
"{{.}}"
{{end}}
{{end}}
{{if hasSSLProxyHeaders $instance}}
[frontends."frontend-{{ $serviceName }}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $instance}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
2017-11-22 11:00:04 +00:00
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
2017-12-20 22:00:52 +00:00
rule = "{{getFrontendRule $instance}}"
{{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
}
2017-11-22 11:00:04 +00:00
var _templatesEurekaTmpl = []byte(`[backends]{{range .Applications}}
{{ $app := .}}
{{range .Instances}}
[backends.backend{{$app.Name}}.servers.server-{{ getInstanceID . }}]
url = "{{ getProtocol . }}://{{ .IpAddr }}:{{ getPort . }}"
weight = {{ getWeight . }}
{{end}}{{end}}
[frontends]{{range .Applications}}
[frontends.frontend{{.Name}}]
backend = "backend{{.Name}}"
entryPoints = ["http"]
[frontends.frontend{{.Name }}.routes.route-host{{.Name}}]
rule = "Host:{{ .Name | tolower }}"
{{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
}
2017-11-22 11:00:04 +00:00
var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend := .Backends}}
[backends."{{$backendName}}"]
{{if $backend.CircuitBreaker}}
[backends."{{$backendName}}".circuitbreaker]
expression = "{{$backend.CircuitBreaker.Expression}}"
{{end}}
[backends."{{$backendName}}".loadbalancer]
method = "{{$backend.LoadBalancer.Method}}"
{{if $backend.LoadBalancer.Sticky}}
sticky = true
{{end}}
{{if $backend.LoadBalancer.Stickiness}}
[backends."{{$backendName}}".loadbalancer.stickiness]
cookieName = "{{$backend.LoadBalancer.Stickiness.CookieName}}"
{{end}}
{{range $serverName, $server := $backend.Servers}}
[backends."{{$backendName}}".servers."{{$serverName}}"]
url = "{{$server.URL}}"
weight = {{$server.Weight}}
{{end}}
{{end}}
[frontends]{{range $frontendName, $frontend := .Frontends}}
[frontends."{{$frontendName}}"]
backend = "{{$frontend.Backend}}"
priority = {{$frontend.Priority}}
passHostHeader = {{$frontend.PassHostHeader}}
2017-12-20 09:26:03 +00:00
entryPoints = [{{range $frontend.EntryPoints}}
"{{.}}",
{{end}}]
2017-11-22 11:00:04 +00:00
basicAuth = [{{range $frontend.BasicAuth}}
"{{.}}",
{{end}}]
whitelistSourceRange = [{{range $frontend.WhitelistSourceRange}}
"{{.}}",
{{end}}]
2017-12-15 10:48:03 +00:00
{{if $frontend.Redirect}}
[frontends."{{$frontendName}}".redirect]
entryPoint = "{{$frontend.RedirectEntryPoint}}"
regex = "{{$frontend.RedirectRegex}}"
replacement = "{{$frontend.RedirectReplacement}}"
{{end}}
2018-01-02 13:49:11 +00:00
{{if $frontend.Headers }}
2017-11-28 12:36:03 +00:00
[frontends."{{$frontendName}}".headers]
SSLRedirect = {{$frontend.Headers.SSLRedirect}}
SSLTemporaryRedirect = {{$frontend.Headers.SSLTemporaryRedirect}}
SSLHost = "{{$frontend.Headers.SSLHost}}"
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}}
ContentSecurityPolicy = "{{$frontend.Headers.ContentSecurityPolicy}}"
PublicKey = "{{$frontend.Headers.PublicKey}}"
ReferrerPolicy = "{{$frontend.Headers.ReferrerPolicy}}"
IsDevelopment = {{$frontend.Headers.IsDevelopment}}
2018-01-02 08:42:03 +00:00
{{if $frontend.Headers.AllowedHosts}}
AllowedHosts = [{{range $frontend.Headers.AllowedHosts}}
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Headers.HostsProxyHeaders}}
HostsProxyHeaders = [{{range $frontend.Headers.HostsProxyHeaders}}
"{{.}}",
{{end}}]
{{end}}
2017-11-28 12:36:03 +00:00
{{if $frontend.Headers.CustomRequestHeaders}}
[frontends."{{$frontendName}}".headers.customrequestheaders]
{{range $k, $v := $frontend.Headers.CustomRequestHeaders}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{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}}
2017-11-22 11:00:04 +00:00
{{range $routeName, $route := $frontend.Routes}}
[frontends."{{$frontendName}}".routes."{{$routeName}}"]
rule = "{{$route.Rule}}"
{{end}}
{{end}}
{{range $tlsConfiguration := .TLSConfiguration}}
[[tlsConfiguration]]
entryPoints = [{{range $tlsConfiguration.EntryPoints}}
"{{.}}",
{{end}}]
[tlsConfiguration.certificate]
certFile = """{{$tlsConfiguration.Certificate.CertFile}}"""
keyFile = """{{$tlsConfiguration.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}}
{{$circuitBreaker := Get "" $backend "/circuitbreaker/expression"}}
{{with $circuitBreaker}}
[backends."{{$backendName}}".circuitBreaker]
2017-11-22 11:00:04 +00:00
expression = "{{$circuitBreaker}}"
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-23 17:15:39 +00:00
{{$loadBalancer := Get "" $backend "/loadbalancer/method"}}
{{with $loadBalancer}}
[backends."{{$backendName}}".loadBalancer]
2017-11-22 11:00:04 +00:00
method = "{{$loadBalancer}}"
2017-12-23 17:15:39 +00:00
sticky = {{ getSticky $backend }}
2017-11-22 11:00:04 +00:00
{{if hasStickinessLabel $backend}}
[backends."{{$backendName}}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-23 17:15:39 +00:00
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-23 17:15:39 +00:00
{{$maxConnAmt := Get "" $backend "/maxconn/amount"}}
{{$maxConnExtractorFunc := Get "" $backend "/maxconn/extractorfunc"}}
{{with $maxConnAmt}}
{{with $maxConnExtractorFunc}}
[backends."{{$backendName}}".maxConn]
2017-11-22 11:00:04 +00:00
amount = {{$maxConnAmt}}
extractorFunc = "{{$maxConnExtractorFunc}}"
2017-12-23 17:15:39 +00:00
{{end}}
{{end}}
{{$healthCheck := Get "" $backend "/healthcheck/path"}}
{{with $healthCheck}}
[backends."{{$backendName}}".healthCheck]
path = "{{$healthCheck}}"
2018-01-03 15:57:34 +00:00
port = {{ Get "0" $backend "/healthcheck/port" }}
2017-12-23 17:15:39 +00:00
interval = "{{ Get "30s" $backend "/healthcheck/interval" }}"
{{end}}
{{range $server := ListServers $backend}}
[backends."{{$backendName}}".servers."{{Last $server}}"]
url = "{{Get "" $server "/url"}}"
weight = {{Get "0" $server "/weight"}}
{{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}}
[frontends."{{$frontendName}}"]
backend = "{{Get "" $frontend "/backend"}}"
priority = {{Get "0" $frontend "/priority"}}
passHostHeader = {{Get "true" $frontend "/passHostHeader"}}
2018-01-03 15:57:34 +00:00
passTLSCert = {{Get "false" $frontend "/passtlscert"}}
2017-12-23 17:15:39 +00:00
{{$entryPoints := SplitGet $frontend "/entrypoints"}}
2017-11-22 11:00:04 +00:00
entryPoints = [{{range $entryPoints}}
"{{.}}",
2017-12-23 17:15:39 +00:00
{{end}}]
2018-01-03 15:57:34 +00:00
{{$whitelistSourceRange := SplitGet $frontend "/whitelistsourcerange"}}
whitelistSourceRange = [{{range $whitelistSourceRange}}
"{{.}}",
{{end}}]
{{$basicAuth := SplitGet $frontend "/basicauth"}}
basicAuth = [{{range $basicAuth}}
"{{.}}",
{{end}}]
{{$redirect := getRedirect $frontend }}
{{ if $redirect }}
[frontends."{{$frontendName}}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
{{end}}
{{ $errorPages := getErrorPages $frontend }}
{{ if $errorPages }}
[frontends."{{$frontendName}}".errors]
{{ range $pageName, $page := $errorPages }}
[frontends."{{$frontendName}}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ $rateLimit := getRateLimit $frontend }}
{{ if $rateLimit }}
[frontends."{{$frontendName}}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."{{$frontendName}}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := $rateLimit.RateSet }}
[frontends."{{$frontendName}}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
{{ $headers := getHeaders $frontend }}
{{ if $headers }}
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
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 }}"
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."{{ $frontendName }}".headers.customRequestHeaders]
{{ range $k, $v := $headers.CustomRequestHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{ if $headers.CustomResponseHeaders }}
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{ range $k, $v := $headers.CustomResponseHeaders }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{ if $headers.SSLProxyHeaders }}
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $headers.SSLProxyHeaders}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
2017-12-23 17:15:39 +00:00
{{range $route := List $frontend "/routes/"}}
[frontends."{{$frontendName}}".routes."{{Last $route}}"]
rule = "{{Get "" $route "/rule"}}"
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-23 17:15:39 +00:00
{{range $tlsConfiguration := List .Prefix "/tlsconfiguration/"}}
[[tlsConfiguration]]
2017-12-23 17:15:39 +00:00
{{$entryPoints := SplitGet $tlsConfiguration "/entrypoints"}}
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
2017-12-23 17:15:39 +00:00
[tlsConfiguration.certificate]
certFile = """{{Get "" $tlsConfiguration "/certificate/certfile"}}"""
keyFile = """{{Get "" $tlsConfiguration "/certificate/keyfile"}}"""
{{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
}
2017-11-22 11:00:04 +00:00
var _templatesMarathonTmpl = []byte(`{{$apps := .Applications}}
2017-12-20 16:27:54 +00:00
[backends]
2017-11-22 11:00:04 +00:00
{{range $app := $apps}}
{{range $serviceIndex, $serviceName := getServiceNames $app}}
2017-12-20 16:27:54 +00:00
[backends."{{getBackend $app $serviceName }}"]
{{ if hasCircuitBreakerLabels $app }}
[backends."{{getBackend $app $serviceName }}".circuitBreaker]
expression = "{{getCircuitBreakerExpression $app }}"
{{end}}
{{ if hasLoadBalancerLabels $app }}
[backends."{{getBackend $app $serviceName }}".loadBalancer]
method = "{{getLoadBalancerMethod $app }}"
sticky = {{getSticky $app}}
{{if hasStickinessLabel $app}}
[backends."{{getBackend $app $serviceName }}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $app}}"
{{end}}
{{end}}
{{ if hasMaxConnLabels $app }}
[backends."{{getBackend $app $serviceName }}".maxConn]
amount = {{getMaxConnAmount $app }}
extractorFunc = "{{getMaxConnExtractorFunc $app }}"
{{end}}
{{ if hasHealthCheckLabels $app }}
[backends."{{getBackend $app $serviceName }}".healthCheck]
path = "{{getHealthCheckPath $app }}"
port = {{getHealthCheckPort $app}}
interval = "{{getHealthCheckInterval $app }}"
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 16:27:54 +00:00
{{range $task := $app.Tasks}}
{{range $serviceIndex, $serviceName := getServiceNames $app}}
[backends."{{getBackend $app $serviceName}}".servers."server-{{$task.ID | replace "." "-"}}{{getServiceNameSuffix $serviceName }}"]
url = "{{getProtocol $app $serviceName}}://{{getBackendServer $task $app}}:{{getPort $task $app $serviceName}}"
weight = {{getWeight $app $serviceName}}
{{end}}
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 16:27:54 +00:00
[frontends]
2017-11-22 11:00:04 +00:00
{{range $app := $apps}}
2017-12-20 16:27:54 +00:00
{{range $serviceIndex, $serviceName := getServiceNames .}}
2017-11-22 11:00:04 +00:00
[frontends."{{ getFrontendName $app $serviceName }}"]
2017-12-20 16:27:54 +00:00
backend = "{{getBackend $app $serviceName}}"
priority = {{getPriority $app $serviceName}}
passHostHeader = {{getPassHostHeader $app $serviceName}}
passTLSCert = {{getPassTLSCert $app $serviceName}}
entryPoints = [{{range getEntryPoints $app $serviceName}}
"{{.}}",
{{end}}]
{{if getWhitelistSourceRange $app $serviceName}}
whitelistSourceRange = [{{range getWhitelistSourceRange $app $serviceName}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth $app $serviceName}}
"{{.}}",
{{end}}]
{{if hasRedirect $app $serviceName}}
[frontends."{{ getFrontendName $app $serviceName }}".redirect]
entryPoint = "{{getRedirectEntryPoint $app $serviceName}}"
regex = "{{getRedirectRegex $app $serviceName}}"
replacement = "{{getRedirectReplacement $app $serviceName}}"
{{end}}
{{ if hasErrorPages $app $serviceName }}
[frontends."{{ getFrontendName $app $serviceName }}".errors]
{{ range $pageName, $page := getErrorPages $app $serviceName }}
[frontends."{{ getFrontendName $app $serviceName }}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ if hasRateLimits $app $serviceName }}
[frontends."{{ getFrontendName $app $serviceName }}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $app $serviceName }}"
[frontends."{{ getFrontendName $app $serviceName }}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getRateLimits $app $serviceName }}
[frontends."{{ getFrontendName $app $serviceName }}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
2018-01-02 13:49:11 +00:00
{{if hasHeaders $app $serviceName }}
2017-12-20 16:27:54 +00:00
[frontends."{{ getFrontendName $app $serviceName }}".headers]
2018-01-02 08:42:03 +00:00
{{if hasSSLRedirectHeaders $app $serviceName}}
SSLRedirect = {{getSSLRedirectHeaders $app $serviceName}}
{{end}}
{{if hasSSLTemporaryRedirectHeaders $app $serviceName}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $app $serviceName}}
{{end}}
{{if hasSSLHostHeaders $app $serviceName}}
SSLHost = "{{getSSLHostHeaders $app $serviceName}}"
{{end}}
{{if hasSTSSecondsHeaders $app $serviceName}}
STSSeconds = {{getSTSSecondsHeaders $app $serviceName}}
{{end}}
{{if hasSTSIncludeSubdomainsHeaders $app $serviceName}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $app $serviceName}}
{{end}}
{{if hasSTSPreloadHeaders $app $serviceName}}
STSPreload = {{getSTSPreloadHeaders $app $serviceName}}
{{end}}
{{if hasForceSTSHeaderHeaders $app $serviceName}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $app $serviceName}}
{{end}}
{{if hasFrameDenyHeaders $app $serviceName}}
FrameDeny = {{getFrameDenyHeaders $app $serviceName}}
{{end}}
{{if hasCustomFrameOptionsValueHeaders $app $serviceName}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $app $serviceName}}"
{{end}}
{{if hasContentTypeNosniffHeaders $app $serviceName}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders $app $serviceName}}
{{end}}
{{if hasBrowserXSSFilterHeaders $app $serviceName}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $app $serviceName}}
{{end}}
{{if hasContentSecurityPolicyHeaders $app $serviceName}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $app $serviceName}}"
{{end}}
{{if hasPublicKeyHeaders $app $serviceName}}
PublicKey = "{{getPublicKeyHeaders $app $serviceName}}"
{{end}}
{{if hasReferrerPolicyHeaders $app $serviceName}}
ReferrerPolicy = "{{getReferrerPolicyHeaders $app $serviceName}}"
{{end}}
{{if hasIsDevelopmentHeaders $app $serviceName}}
IsDevelopment = {{getIsDevelopmentHeaders $app $serviceName}}
{{end}}
{{if hasAllowedHostsHeaders $app $serviceName}}
AllowedHosts = [{{range getAllowedHostsHeaders $app $serviceName}}
"{{.}}",
{{end}}]
{{end}}
{{if hasHostsProxyHeaders $app $serviceName}}
HostsProxyHeaders = [{{range getHostsProxyHeaders $app $serviceName}}
"{{.}}",
{{end}}]
{{end}}
{{if hasRequestHeaders $app $serviceName}}
[frontends."{{ getFrontendName $app $serviceName }}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $app $serviceName}}
{{$k}} = "{{$v}}"
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
{{end}}
{{if hasResponseHeaders $app $serviceName}}
[frontends."{{ getFrontendName $app $serviceName }}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $app $serviceName}}
{{$k}} = "{{$v}}"
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
{{end}}
{{if hasSSLProxyHeaders $app $serviceName}}
[frontends."{{ getFrontendName $app $serviceName }}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $app $serviceName}}
{{$k}} = "{{$v}}"
2017-12-20 16:27:54 +00:00
{{end}}
2018-01-02 08:42:03 +00:00
{{end}}
2018-01-02 13:49:11 +00:00
{{end}}
2017-12-20 16:27:54 +00:00
2018-01-02 08:42:03 +00:00
[frontends."{{ getFrontendName $app $serviceName }}".routes."route-host{{$app.ID | replace "/" "-"}}{{getServiceNameSuffix $serviceName }}"]
rule = "{{getFrontendRule $app $serviceName}}"
2017-12-20 16:27:54 +00:00
{{end}}
{{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
}
2017-11-22 11:00:04 +00:00
var _templatesMesosTmpl = []byte(`{{$apps := .Applications}}
[backends]{{range .Tasks}}
[backends.backend{{getBackend . $apps}}.servers.server-{{getID .}}]
url = "{{getProtocol . $apps}}://{{getHost .}}:{{getPort . $apps}}"
weight = {{getWeight . $apps}}
{{end}}
[frontends]{{range .Applications}}
[frontends.frontend-{{getFrontEndName .}}]
backend = "backend{{getFrontendBackend .}}"
passHostHeader = {{getPassHostHeader .}}
priority = {{getPriority .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
[frontends.frontend-{{getFrontEndName .}}.routes.route-host{{getFrontEndName .}}]
rule = "{{getFrontendRule .}}"
{{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
}
2017-11-22 11:00:04 +00:00
var _templatesRancherTmpl = []byte(`{{$backendServers := .Backends}}
2017-12-20 15:48:30 +00:00
[backends]
{{range $backendName, $backend := .Backends}}
2017-11-22 11:00:04 +00:00
2017-12-20 15:48:30 +00:00
[backends.backend-{{$backendName}}]
2017-11-22 11:00:04 +00:00
2017-12-20 15:48:30 +00:00
{{if hasCircuitBreakerLabel $backend}}
[backends.backend-{{$backendName}}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $backend}}"
{{end}}
2017-11-22 11:00:04 +00:00
2017-12-20 15:48:30 +00:00
{{if hasLoadBalancerLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer]
method = "{{getLoadBalancerMethod $backend}}"
sticky = {{getSticky $backend}}
{{if hasStickinessLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 15:48:30 +00:00
{{end}}
{{if hasMaxConnLabels $backend}}
[backends.backend-{{$backendName}}.maxConn]
amount = {{getMaxConnAmount $backend}}
extractorFunc = "{{getMaxConnExtractorFunc $backend}}"
{{end}}
{{if hasHealthCheckLabels $backend}}
[backends.backend-{{$backendName}}.healthCheck]
path = "{{getHealthCheckPath $backend}}"
port = {{getHealthCheckPort $backend}}
interval = "{{getHealthCheckInterval $backend}}"
{{end}}
{{range $index, $ip := $backend.Containers}}
[backends.backend-{{$backendName}}.servers.server-{{$index}}]
url = "{{getProtocol $backend}}://{{$ip}}:{{getPort $backend}}"
weight = {{getWeight $backend}}
{{end}}
2017-11-22 11:00:04 +00:00
{{end}}
2017-12-20 15:48:30 +00:00
[frontends]
{{range $frontendName, $service := .Frontends}}
[frontends."frontend-{{$frontendName}}"]
2017-11-22 11:00:04 +00:00
backend = "backend-{{getBackend $service}}"
priority = {{getPriority $service}}
2017-12-20 15:48:30 +00:00
passHostHeader = {{getPassHostHeader $service}}
passTLSCert = {{getPassTLSCert $service}}
2017-11-22 11:00:04 +00:00
entryPoints = [{{range getEntryPoints $service}}
2017-12-20 15:48:30 +00:00
"{{.}}",
{{end}}]
{{if getWhitelistSourceRange $service}}
whitelistSourceRange = [{{range getWhitelistSourceRange $service}}
"{{.}}",
{{end}}]
{{end}}
2017-11-22 11:00:04 +00:00
basicAuth = [{{range getBasicAuth $service}}
2017-12-20 15:48:30 +00:00
"{{.}}",
{{end}}]
2017-12-15 10:48:03 +00:00
{{if hasRedirect $service}}
[frontends."frontend-{{$frontendName}}".redirect]
2017-12-20 15:48:30 +00:00
entryPoint = "{{getRedirectEntryPoint $service}}"
regex = "{{getRedirectRegex $service}}"
replacement = "{{getRedirectReplacement $service}}"
2017-12-15 10:48:03 +00:00
{{end}}
2017-12-20 15:48:30 +00:00
{{ if hasErrorPages $service }}
[frontends."frontend-{{$frontendName}}".errors]
{{ range $pageName, $page := getErrorPages $service }}
[frontends."frontend-{{$frontendName}}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ if hasRateLimits $service }}
[frontends."frontend-{{$frontendName}}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $service }}"
[frontends."frontend-{{$frontendName}}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getRateLimits $service }}
[frontends."frontend-{{$frontendName}}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
{{if hasHeaders $service }}
[frontends."frontend-{{$frontendName}}".headers]
SSLRedirect = {{getSSLRedirectHeaders $service}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $service}}
SSLHost = "{{getSSLHostHeaders $service}}"
STSSeconds = {{getSTSSecondsHeaders $service}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $service}}
STSPreload = {{getSTSPreloadHeaders $service}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $service}}
FrameDeny = {{getFrameDenyHeaders $service}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $service}}"
ContentTypeNosniff = {{getContentTypeNosniffHeaders $service}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $service}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $service}}"
PublicKey = "{{getPublicKeyHeaders $service}}"
ReferrerPolicy = "{{getReferrerPolicyHeaders $service}}"
IsDevelopment = {{getIsDevelopmentHeaders $service}}
AllowedHosts = [{{range getAllowedHostsHeaders $service}}
"{{.}}",
{{end}}]
HostsProxyHeaders = [{{range getHostsProxyHeaders $service}}
"{{.}}",
{{end}}]
{{if hasRequestHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasResponseHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasSSLProxyHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{end}}
2017-11-22 11:00:04 +00:00
[frontends."frontend-{{$frontendName}}".routes."route-frontend-{{$frontendName}}"]
2017-12-20 15:48:30 +00:00
rule = "{{getFrontendRule $service}}"
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){
"templates/consul_catalog.tmpl": templatesConsul_catalogTmpl,
2017-11-21 20:30:03 +00:00
"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{
"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, "/")...)...)
}