1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-23 17:34:13 +03:00

Fix default weight in server.LoadConfig

Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
Emile Vauge 2016-07-04 19:30:32 +02:00
parent ecaa146d5b
commit 018b8a6315
No known key found for this signature in database
GPG Key ID: D808B4C167352E59
3 changed files with 29 additions and 14 deletions

18
glide.lock generated
View File

@ -1,5 +1,5 @@
hash: 45fb23231bebf9ca56942d7a2454f7b398158ffa62a91e092c50e894efdd9df6
updated: 2016-06-22T15:11:43.335984235+02:00
hash: b9d7a2fa4fe03a52e8239223ded2db0372cda7de452ea36a7e10eb04bd791b91
updated: 2016-07-04T18:12:56.78124934+02:00
imports:
- name: github.com/boltdb/bolt
version: 3f7947a25d970e1e5f512276c14d5dcf731ccd5e
@ -36,7 +36,7 @@ imports:
subpackages:
- spew
- name: github.com/docker/distribution
version: edd7cb5249d0a45262b20bb58b838ecf4fb368bd
version: 4e17ab5d319ac5b70b2769442947567a83386fbc
subpackages:
- reference
- digest
@ -72,7 +72,7 @@ imports:
- name: github.com/docker/libcompose
version: 8ee7bcc364f7b8194581a3c6bd9fa019467c7873
- name: github.com/docker/libkv
version: 7283ef27ed32fe267388510a91709b307bb9942c
version: 35d3e2084c650109e7bcc7282655b1bc8ba924ff
subpackages:
- store
- store/boltdb
@ -94,7 +94,7 @@ imports:
- name: github.com/gorilla/context
version: aed02d124ae4a0e94fea4541c8effd05bf0c8296
- name: github.com/hashicorp/consul
version: 09cfda47ed103910a8e1af76fa378a7e6acd5310
version: 6e061b2d580d80347b7c5c4dfc8730de7403a145
subpackages:
- api
- name: github.com/hashicorp/go-cleanhttp
@ -125,11 +125,11 @@ imports:
- name: github.com/ogier/pflag
version: 45c278ab3607870051a2ea9040bb85fcb8557481
- name: github.com/opencontainers/runc
version: 5dc3f3576efb5262bf582217e93f86c93944374d
version: 7221e387826c9918fa9fd6e7975baf4d30c8fa54
subpackages:
- libcontainer/user
- name: github.com/parnurzeal/gorequest
version: f17fef20c518e688f4edb3eb2af148462ecab3ef
version: 6e8ad4ebdee4bec2934ed5afaaa1c7b877832a17
- name: github.com/pmezard/go-difflib
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
subpackages:
@ -187,7 +187,7 @@ imports:
subpackages:
- acme
- name: golang.org/x/crypto
version: f3241ce8505855877cc8a9717bd61a0f7c4ea83c
version: 0c565bf13221fb55497d7ae2bb95694db1fd1bff
subpackages:
- ocsp
- name: golang.org/x/net
@ -202,7 +202,7 @@ imports:
- unix
- windows
- name: gopkg.in/fsnotify.v1
version: 30411dbcefb7a1da7e84f75530ad3abe4011b4f8
version: a8a77c9133d2d6fd8334f3260d06f60e8d80a5fb
- name: gopkg.in/mgo.v2
version: 29cc868a5ca65f401ff318143f9408d02f4799cc
subpackages:

View File

@ -10,9 +10,9 @@ import:
- package: github.com/containous/flaeg
version: b98687da5c323650f4513fda6b6203fcbdec9313
- package: github.com/vulcand/oxy
vcs: git
version: b57d6706e9ff606343c596940b60df7f90012d29
repo: https://github.com/containous/oxy.git
version: b57d6706e9ff606343c596940b60df7f90012d29
vcs: git
subpackages:
- cbreaker
- connlimit
@ -56,7 +56,7 @@ import:
- package: github.com/thoas/stats
- package: github.com/unrolled/render
- package: github.com/vdemeester/docker-events
- version: 20e6d2db238723e68197a9e3c6c34c99a9893a9c
version: 20e6d2db238723e68197a9e3c6c34c99a9893a9c
- package: github.com/vulcand/vulcand
subpackages:
- plugin/rewrite

View File

@ -181,6 +181,13 @@ func (server *Server) defaultConfigurationValues(configuration *types.Configurat
frontend.EntryPoints = server.globalConfiguration.DefaultEntryPoints
}
}
for backendName, backend := range configuration.Backends {
_, err := types.NewLoadBalancerMethod(backend.LoadBalancer)
if err != nil {
log.Warnf("Error loading load balancer method '%+v' for backend %s: %v. Using default wrr.", backend.LoadBalancer, backendName, err)
backend.LoadBalancer = &types.LoadBalancer{Method: "wrr"}
}
}
}
func (server *Server) listenConfigurations(stop chan bool) {
@ -389,7 +396,13 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
frontend := configuration.Frontends[frontendName]
log.Debugf("Creating frontend %s", frontendName)
fwd, _ := forward.New(forward.Logger(oxyLogger), forward.PassHostHeader(frontend.PassHostHeader))
fwd, err := forward.New(forward.Logger(oxyLogger), forward.PassHostHeader(frontend.PassHostHeader))
if err != nil {
log.Errorf("Error creating forwarder for frontend %s: %v", frontendName, err)
log.Errorf("Skipping frontend %s...", frontendName)
continue frontend
}
saveBackend := middlewares.NewSaveBackend(fwd)
if len(frontend.EntryPoints) == 0 {
log.Errorf("No entrypoint defined for frontend %s, defaultEntryPoints:%s", frontendName, globalConfiguration.DefaultEntryPoints)
@ -437,7 +450,9 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
}
lbMethod, err := types.NewLoadBalancerMethod(configuration.Backends[frontend.Backend].LoadBalancer)
if err != nil {
configuration.Backends[frontend.Backend].LoadBalancer = &types.LoadBalancer{Method: "wrr"}
log.Errorf("Error loading load balancer method '%+v' for frontend %s: %v", configuration.Backends[frontend.Backend].LoadBalancer, frontendName, err)
log.Errorf("Skipping frontend %s...", frontendName)
continue frontend
}
switch lbMethod {
case types.Drr: