Retry initial backend configuration
This commit is contained in:
parent
469797e242
commit
ee6bb942e5
1 changed files with 17 additions and 8 deletions
|
@ -185,17 +185,26 @@ func (n *NGINXController) syncIngress(interface{}) error {
|
||||||
|
|
||||||
isFirstSync := n.runningConfig.Equal(&ingress.Configuration{})
|
isFirstSync := n.runningConfig.Equal(&ingress.Configuration{})
|
||||||
go func(isFirstSync bool) {
|
go func(isFirstSync bool) {
|
||||||
|
maxAttempts := 1
|
||||||
if isFirstSync {
|
if isFirstSync {
|
||||||
glog.Infof("Initial synchronization of the NGINX configuration.")
|
// For the initial sync it always takes some time for NGINX to
|
||||||
|
// start listening on the configured port (default 18080)
|
||||||
// it takes time for NGINX to start listening on the configured ports
|
// For large configurations it might take a while so we loop
|
||||||
|
// and back off
|
||||||
|
maxAttempts = 15
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
err := configureDynamically(pcfg, n.cfg.ListenPorts.Status, n.cfg.DynamicCertificatesEnabled)
|
|
||||||
if err == nil {
|
for i := 0; i < maxAttempts; i++ {
|
||||||
glog.Infof("Dynamic reconfiguration succeeded.")
|
err := configureDynamically(pcfg, n.cfg.ListenPorts.Status, n.cfg.DynamicCertificatesEnabled)
|
||||||
} else {
|
if err == nil {
|
||||||
glog.Warningf("Dynamic reconfiguration failed: %v", err)
|
glog.Infof("Dynamic reconfiguration succeeded.")
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
glog.Warningf("Dynamic reconfiguration failed: %v", err)
|
||||||
|
// Sleep between retries backing off up to 120s total
|
||||||
|
time.Sleep(time.Duration(i+1) * time.Second)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}(isFirstSync)
|
}(isFirstSync)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue