1
0
Fork 0

fix: backend name for stateful service and more.

This commit is contained in:
Ludovic Fernandez 2018-04-13 15:44:04 +02:00 committed by Traefiker Bot
parent 89c3930b28
commit 1f3fc8a366
5 changed files with 81 additions and 70 deletions

View file

@ -59,7 +59,7 @@ const tmpl = `
{{range $instance := $partition.Instances}}
[backends."{{ $service.Name }}".servers."{{ $instance.ID }}"]
url = "{{ getDefaultEndpoint $instance }}"
weight = {{ getLabelValue $service "backend.weight" "1" }}
weight = {{ getWeight $service }}
{{end}}
{{else if isStateful $service}}
@ -199,17 +199,18 @@ const tmpl = `
rule = "{{ $value }}"
{{end}}
{{else if isStateful $service}}
{{else if isStateful $service }}
{{range $partition := $service.Partitions }}
{{ $partitionId := $partition.PartitionInformation.ID }}
{{if hasLabel $service "frontend.rule" }}
[frontends."{{ $service.Name }}/{{ $partitionId }}"]
backend = "{{ getBackendName $service.Name $partition }}"
{{ $rule := getLabelValue $service (print "traefik.frontend.rule.partition." $partitionId) "" }}
{{if $rule }}
[frontends."{{ $service.Name }}/{{ $partitionId }}"]
backend = "{{ getBackendName $service $partition }}"
[frontends."{{ $service.Name }}/{{ $partitionId }}".routes.default]
rule = {{ getLabelValue $service "frontend.rule.partition.$partitionId" "" }}
rule = "{{ $rule }}"
{{end}}
{{end}}