1
0
Fork 0

Don't reload configuration when rancher server is down

This commit is contained in:
Roman Pridybailo 2018-01-22 12:00:07 +02:00 committed by Traefiker
parent ae34486b57
commit fc00e1c228

View file

@ -91,11 +91,15 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool
for { for {
select { select {
case <-ticker.C: case <-ticker.C:
checkAPI, errAPI := rancherClient.ApiKey.List(withoutPagination)
log.Debugf("Refreshing new Data from Provider API") if errAPI != nil {
var stacks = listRancherStacks(rancherClient) log.Errorf("Cannot establish connection: %+v, Rancher API return: %+v; Skipping refresh Data from Rancher API.", errAPI, checkAPI)
var services = listRancherServices(rancherClient) } else {
var container = listRancherContainer(rancherClient) log.Debugf("Refreshing new Data from Rancher API")
stacks := listRancherStacks(rancherClient)
services := listRancherServices(rancherClient)
container := listRancherContainer(rancherClient)
rancherData := parseAPISourcedRancherData(stacks, services, container) rancherData := parseAPISourcedRancherData(stacks, services, container)
@ -106,6 +110,7 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool
Configuration: configuration, Configuration: configuration,
} }
} }
}
case <-stop: case <-stop:
ticker.Stop() ticker.Stop()
cancel() cancel()