diff --git a/Gopkg.lock b/Gopkg.lock index c3478844c..5fb6b1313 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1387,6 +1387,7 @@ name = "gopkg.in/fsnotify.v1" packages = ["."] revision = "629574ca2a5df945712d3079857300b5e4da0236" + source = "github.com/fsnotify/fsnotify" version = "v1.4.2" [[projects]] @@ -1568,6 +1569,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "2fca312eff66fbc2aa41319f67d2c78cf8117bd6b5f7791cf20bddb7fdb7e0af" + inputs-digest = "84c2472bf857de46a07c80e8b5798fa7a59246b7c6f7f4765808dadd7863e712" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index fe44d4e58..19fdd8c5b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -190,6 +190,7 @@ [[constraint]] name = "gopkg.in/fsnotify.v1" + source = "github.com/fsnotify/fsnotify" version = "1.4.2" [[constraint]] diff --git a/docs/configuration/backends/kubernetes.md b/docs/configuration/backends/kubernetes.md index 117e17cbb..781a3c796 100644 --- a/docs/configuration/backends/kubernetes.md +++ b/docs/configuration/backends/kubernetes.md @@ -114,8 +114,8 @@ If the service port defined in the ingress spec is 443, then the backend communi !!! note Please note that by enabling TLS communication between traefik and your pods, you will have to have trusted certificates that have the proper trust chain and IP subject name. If this is not an option, you may need to skip TLS certificate verification. - See the [InsecureSkipVerify](configuration/commons/#main-section) setting for more details. - + See the [InsecureSkipVerify](/configuration/commons/#main-section) setting for more details. + ## Annotations ### General annotations diff --git a/docs/user-guide/kubernetes.md b/docs/user-guide/kubernetes.md index 3bf8b836e..2b054c50a 100644 --- a/docs/user-guide/kubernetes.md +++ b/docs/user-guide/kubernetes.md @@ -184,9 +184,9 @@ spec: securityContext: privileged: true args: - - -d - --api - --kubernetes + - --logLevel=INFO --- kind: Service apiVersion: v1 diff --git a/examples/k8s/traefik-deployment.yaml b/examples/k8s/traefik-deployment.yaml index 23f81cbe2..ccf18bfb1 100644 --- a/examples/k8s/traefik-deployment.yaml +++ b/examples/k8s/traefik-deployment.yaml @@ -31,6 +31,7 @@ spec: args: - --api - --kubernetes + - --logLevel=INFO --- kind: Service apiVersion: v1 diff --git a/examples/k8s/traefik-ds.yaml b/examples/k8s/traefik-ds.yaml index 1836c95c8..285739e53 100644 --- a/examples/k8s/traefik-ds.yaml +++ b/examples/k8s/traefik-ds.yaml @@ -34,9 +34,9 @@ spec: securityContext: privileged: true args: - - -d - --api - --kubernetes + - --logLevel=INFO --- kind: Service apiVersion: v1 diff --git a/provider/consulcatalog/consul_catalog.go b/provider/consulcatalog/consul_catalog.go index a212047fe..e79fe09d4 100644 --- a/provider/consulcatalog/consul_catalog.go +++ b/provider/consulcatalog/consul_catalog.go @@ -3,6 +3,7 @@ package consulcatalog import ( "errors" "strings" + "sync" "text/template" "time" @@ -138,8 +139,15 @@ func (p *Provider) watch(configurationChan chan<- types.ConfigMessage, stop chan watchCh := make(chan map[string][]string) errorCh := make(chan error) - p.watchHealthState(stopCh, watchCh, errorCh) - p.watchCatalogServices(stopCh, watchCh, errorCh) + var errorOnce sync.Once + notifyError := func(err error) { + errorOnce.Do(func() { + errorCh <- err + }) + } + + p.watchHealthState(stopCh, watchCh, notifyError) + p.watchCatalogServices(stopCh, watchCh, notifyError) defer close(stopCh) defer close(watchCh) @@ -155,7 +163,7 @@ func (p *Provider) watch(configurationChan chan<- types.ConfigMessage, stop chan log.Debug("List of services changed") nodes, err := p.getNodes(index) if err != nil { - return err + notifyError(err) } configuration := p.buildConfiguration(nodes) configurationChan <- types.ConfigMessage{ @@ -168,7 +176,7 @@ func (p *Provider) watch(configurationChan chan<- types.ConfigMessage, stop chan } } -func (p *Provider) watchCatalogServices(stopCh <-chan struct{}, watchCh chan<- map[string][]string, errorCh chan<- error) { +func (p *Provider) watchCatalogServices(stopCh <-chan struct{}, watchCh chan<- map[string][]string, notifyError func(error)) { catalog := p.client.Catalog() safe.Go(func() { @@ -187,7 +195,7 @@ func (p *Provider) watchCatalogServices(stopCh <-chan struct{}, watchCh chan<- m data, meta, err := catalog.Services(options) if err != nil { log.Errorf("Failed to list services: %v", err) - errorCh <- err + notifyError(err) return } @@ -203,7 +211,7 @@ func (p *Provider) watchCatalogServices(stopCh <-chan struct{}, watchCh chan<- m nodes, _, err := catalog.Service(key, "", &api.QueryOptions{}) if err != nil { log.Errorf("Failed to get detail of service %s: %v", key, err) - errorCh <- err + notifyError(err) return } @@ -239,7 +247,7 @@ func (p *Provider) watchCatalogServices(stopCh <-chan struct{}, watchCh chan<- m }) } -func (p *Provider) watchHealthState(stopCh <-chan struct{}, watchCh chan<- map[string][]string, errorCh chan<- error) { +func (p *Provider) watchHealthState(stopCh <-chan struct{}, watchCh chan<- map[string][]string, notifyError func(error)) { health := p.client.Health() catalog := p.client.Catalog() @@ -260,7 +268,7 @@ func (p *Provider) watchHealthState(stopCh <-chan struct{}, watchCh chan<- map[s healthyState, meta, err := health.State("passing", options) if err != nil { log.WithError(err).Error("Failed to retrieve health checks") - errorCh <- err + notifyError(err) return } @@ -284,7 +292,7 @@ func (p *Provider) watchHealthState(stopCh <-chan struct{}, watchCh chan<- map[s data, _, err := catalog.Services(&api.QueryOptions{}) if err != nil { log.Errorf("Failed to list services: %v", err) - errorCh <- err + notifyError(err) return } diff --git a/server/server_test.go b/server/server_test.go index 46632fec5..27adf118e 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -1,6 +1,7 @@ package server import ( + "context" "fmt" "net/http" "net/http/httptest" @@ -9,8 +10,6 @@ import ( "testing" "time" - "context" - "github.com/containous/flaeg" "github.com/containous/mux" "github.com/containous/traefik/configuration"