Merge branch 'v1.5' into master

This commit is contained in:
Fernandez Ludovic 2018-03-21 22:43:15 +01:00
commit 007a1fc7f2
8 changed files with 26 additions and 16 deletions

3
Gopkg.lock generated
View file

@ -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

View file

@ -190,6 +190,7 @@
[[constraint]]
name = "gopkg.in/fsnotify.v1"
source = "github.com/fsnotify/fsnotify"
version = "1.4.2"
[[constraint]]

View file

@ -114,7 +114,7 @@ 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

View file

@ -184,9 +184,9 @@ spec:
securityContext:
privileged: true
args:
- -d
- --api
- --kubernetes
- --logLevel=INFO
---
kind: Service
apiVersion: v1

View file

@ -31,6 +31,7 @@ spec:
args:
- --api
- --kubernetes
- --logLevel=INFO
---
kind: Service
apiVersion: v1

View file

@ -34,9 +34,9 @@ spec:
securityContext:
privileged: true
args:
- -d
- --api
- --kubernetes
- --logLevel=INFO
---
kind: Service
apiVersion: v1

View file

@ -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
}

View file

@ -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"