fix: backend name for stateful service.

This commit is contained in:
Ludovic Fernandez 2018-04-13 14:38:03 +02:00 committed by Traefiker Bot
parent 2641832304
commit 29e1e9eef2
3 changed files with 13 additions and 11 deletions

6
Gopkg.lock generated
View file

@ -232,8 +232,8 @@
[[projects]] [[projects]]
name = "github.com/containous/traefik-extra-service-fabric" name = "github.com/containous/traefik-extra-service-fabric"
packages = ["."] packages = ["."]
revision = "ca1fb57108293caad285b1c366b763f6c6ab71c9" revision = "dd5326f23d6e529aa327c10ce1f996079f5d7262"
version = "v1.0.5" version = "v1.0.6"
[[projects]] [[projects]]
name = "github.com/coreos/bbolt" name = "github.com/coreos/bbolt"
@ -1400,6 +1400,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "7994872ae2ae128f087243191120faabaac8a738140a5ca664422a8f709827ec" inputs-digest = "2211d5f1d7b7137b83976ba0a92441ef7a80c8a858eabb7d9a5102d7b3dfbe4f"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View file

@ -68,7 +68,7 @@ ignored = ["github.com/sirupsen/logrus"]
[[constraint]] [[constraint]]
name = "github.com/containous/traefik-extra-service-fabric" name = "github.com/containous/traefik-extra-service-fabric"
version = "1.0.5" version = "1.0.6"
[[constraint]] [[constraint]]
name = "github.com/coreos/go-systemd" name = "github.com/coreos/go-systemd"

View file

@ -58,7 +58,7 @@ const tmpl = `
{{range $replica := $partition.Replicas}} {{range $replica := $partition.Replicas}}
{{if isPrimary $replica}} {{if isPrimary $replica}}
{{$backendName := getBackendName $service.Name $partition}} {{$backendName := getBackendName $service $partition}}
[backends."{{$backendName}}".servers."{{$replica.ID}}"] [backends."{{$backendName}}".servers."{{$replica.ID}}"]
url = "{{getDefaultEndpoint $replica}}" url = "{{getDefaultEndpoint $replica}}"
weight = 1 weight = 1
@ -126,13 +126,15 @@ const tmpl = `
{{range $partition := $service.Partitions}} {{range $partition := $service.Partitions}}
{{$partitionId := $partition.PartitionInformation.ID}} {{$partitionId := $partition.PartitionInformation.ID}}
{{if hasLabel $service "frontend.rule"}} {{ $rule := getLabelValue $service (print "frontend.rule.partition." $partitionId) "" }}
[frontends."{{$service.Name}}/{{$partitionId}}"] {{if $rule }}
backend = "{{getBackendName $service.Name $partition}}" [frontends."{{ $service.Name }}/{{ $partitionId }}"]
[frontends."{{$service.Name}}/{{$partitionId}}".routes.default] backend = "{{ getBackendName $service $partition }}"
rule = {{getLabelValue $service "frontend.rule.partition.$partitionId" ""}}
[frontends."{{ $service.Name }}/{{ $partitionId }}".routes.default]
rule = "{{ $rule }}"
{{end}}
{{end}}
{{end}} {{end}}
{{end}} {{end}}
{{end}} {{end}}