rework loadbalancer support

This commit is contained in:
Julien Salleyron 2019-06-05 22:18:06 +02:00 committed by Traefiker Bot
parent b143101f82
commit 518a37e776
86 changed files with 339 additions and 1055 deletions

View file

@ -120,7 +120,7 @@ func WithRule(rule string) func(*config.Router) {
func WithServers(opts ...func(*config.Server)) func(*config.LoadBalancerService) {
return func(b *config.LoadBalancerService) {
for _, opt := range opts {
server := config.Server{Weight: 1}
server := config.Server{}
opt(&server)
b.Servers = append(b.Servers, server)
}
@ -137,13 +137,6 @@ func WithServer(url string, opts ...func(*config.Server)) func(*config.Server) {
}
}
// WithLBMethod is a helper to create a configuration.
func WithLBMethod(method string) func(*config.LoadBalancerService) {
return func(b *config.LoadBalancerService) {
b.Method = method
}
}
// WithStickiness is a helper to create a configuration.
func WithStickiness(cookieName string) func(*config.LoadBalancerService) {
return func(b *config.LoadBalancerService) {