chore(ecs): gen templates.
This commit is contained in:
parent
393651f5e2
commit
dceccbdb92
1 changed files with 167 additions and 26 deletions
|
@ -409,42 +409,183 @@ func templatesDockerTmpl() (*asset, error) {
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _templatesEcsTmpl = []byte(`[backends]{{range $serviceName, $instances := .Services}}
|
var _templatesEcsTmpl = []byte(`[backends]
|
||||||
[backends.backend-{{ $serviceName }}.loadbalancer]
|
{{range $serviceName, $instances := .Services}}
|
||||||
|
|
||||||
|
{{if hasCircuitBreakerLabel $instances}}
|
||||||
|
[backends.backend-{{ $serviceName }}.circuitBreaker]
|
||||||
|
expression = "{{getCircuitBreakerExpression $instances}}"
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if hasLoadBalancerLabel $instances}}
|
||||||
|
[backends.backend-{{ $serviceName }}.loadBalancer]
|
||||||
method = "{{ getLoadBalancerMethod $instances}}"
|
method = "{{ getLoadBalancerMethod $instances}}"
|
||||||
sticky = {{ getSticky $instances}}
|
sticky = {{ getSticky $instances}}
|
||||||
{{if hasStickinessLabel $instances}}
|
{{if hasStickinessLabel $instances}}
|
||||||
[backends.backend-{{ $serviceName }}.loadbalancer.stickiness]
|
[backends.backend-{{ $serviceName }}.loadBalancer.stickiness]
|
||||||
cookieName = "{{getStickinessCookieName $instances}}"
|
cookieName = "{{getStickinessCookieName $instances}}"
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ if hasHealthCheckLabels $instances }}
|
|
||||||
[backends.backend-{{ $serviceName }}.healthcheck]
|
|
||||||
path = "{{getHealthCheckPath $instances }}"
|
|
||||||
interval = "{{getHealthCheckInterval $instances }}"
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{range $index, $i := $instances}}
|
|
||||||
[backends.backend-{{ $i.Name }}.servers.server-{{ $i.Name }}{{ $i.ID }}]
|
|
||||||
url = "{{ getProtocol $i }}://{{ getHost $i }}:{{ getPort $i }}"
|
|
||||||
weight = {{ getWeight $i}}
|
|
||||||
{{end}}
|
{{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}}
|
||||||
|
|
||||||
|
{{range $index, $instance := $instances}}
|
||||||
|
[backends.backend-{{ $instance.Name }}.servers.server-{{ $instance.Name }}{{ $instance.ID }}]
|
||||||
|
url = "{{ getProtocol $instance }}://{{ getHost $instance }}:{{ getPort $instance }}"
|
||||||
|
weight = {{ getWeight $instance}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
[frontends]{{range $serviceName, $instances := .Services}}
|
[frontends]
|
||||||
{{range filterFrontends $instances}}
|
{{range $serviceName, $instances := .Services}}
|
||||||
[frontends.frontend-{{ $serviceName }}]
|
{{range $instance := filterFrontends $instances}}
|
||||||
backend = "backend-{{ $serviceName }}"
|
|
||||||
passHostHeader = {{ getPassHostHeader .}}
|
[frontends.frontend-{{ $serviceName }}]
|
||||||
priority = {{ getPriority .}}
|
backend = "backend-{{ $serviceName }}"
|
||||||
entryPoints = [{{range getEntryPoints .}}
|
priority = {{ getPriority $instance}}
|
||||||
|
passHostHeader = {{ getPassHostHeader $instance}}
|
||||||
|
passTLSCert = {{ getPassTLSCert $instance}}
|
||||||
|
|
||||||
|
entryPoints = [{{range getEntryPoints $instance}}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
{{end}}]
|
{{end}}]
|
||||||
basicAuth = [{{range getBasicAuth .}}
|
|
||||||
|
{{if getWhitelistSourceRange $instance}}
|
||||||
|
whitelistSourceRange = [{{range getWhitelistSourceRange $instance}}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
{{end}}]
|
{{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}}
|
||||||
|
|
||||||
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
|
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
|
||||||
rule = "{{getFrontendRule .}}"
|
rule = "{{getFrontendRule $instance}}"
|
||||||
{{end}}
|
|
||||||
|
{{end}}
|
||||||
{{end}}`)
|
{{end}}`)
|
||||||
|
|
||||||
func templatesEcsTmplBytes() ([]byte, error) {
|
func templatesEcsTmplBytes() ([]byte, error) {
|
||||||
|
|
Loading…
Reference in a new issue