Don't reload configuration when rancher server is down
This commit is contained in:
parent
ae34486b57
commit
fc00e1c228
1 changed files with 15 additions and 10 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue