Merge pull request #902 from aledbf/fix-configmap-update
Always reload after a change in the configuration
This commit is contained in:
commit
fb32e471b9
1 changed files with 8 additions and 1 deletions
|
@ -110,7 +110,11 @@ type GenericController struct {
|
||||||
|
|
||||||
stopCh chan struct{}
|
stopCh chan struct{}
|
||||||
|
|
||||||
|
// runningConfig contains the running configuration in the Backend
|
||||||
runningConfig *ingress.Configuration
|
runningConfig *ingress.Configuration
|
||||||
|
|
||||||
|
// configmapChanged indicates the configmap
|
||||||
|
configmapChanged bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration contains all the settings required by an Ingress controller
|
// Configuration contains all the settings required by an Ingress controller
|
||||||
|
@ -258,6 +262,7 @@ func newIngressController(config *Configuration) *GenericController {
|
||||||
if mapKey == ic.cfg.ConfigMapName {
|
if mapKey == ic.cfg.ConfigMapName {
|
||||||
glog.V(2).Infof("adding configmap %v to backend", mapKey)
|
glog.V(2).Infof("adding configmap %v to backend", mapKey)
|
||||||
ic.cfg.Backend.SetConfig(upCmap)
|
ic.cfg.Backend.SetConfig(upCmap)
|
||||||
|
ic.configmapChanged = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdateFunc: func(old, cur interface{}) {
|
UpdateFunc: func(old, cur interface{}) {
|
||||||
|
@ -267,6 +272,7 @@ func newIngressController(config *Configuration) *GenericController {
|
||||||
if mapKey == ic.cfg.ConfigMapName {
|
if mapKey == ic.cfg.ConfigMapName {
|
||||||
glog.V(2).Infof("updating configmap backend (%v)", mapKey)
|
glog.V(2).Infof("updating configmap backend (%v)", mapKey)
|
||||||
ic.cfg.Backend.SetConfig(upCmap)
|
ic.cfg.Backend.SetConfig(upCmap)
|
||||||
|
ic.configmapChanged = true
|
||||||
}
|
}
|
||||||
// updates to configuration configmaps can trigger an update
|
// updates to configuration configmaps can trigger an update
|
||||||
if mapKey == ic.cfg.ConfigMapName || mapKey == ic.cfg.TCPConfigMapName || mapKey == ic.cfg.UDPConfigMapName {
|
if mapKey == ic.cfg.ConfigMapName || mapKey == ic.cfg.TCPConfigMapName || mapKey == ic.cfg.UDPConfigMapName {
|
||||||
|
@ -413,7 +419,7 @@ func (ic *GenericController) syncIngress(key interface{}) error {
|
||||||
PassthroughBackends: passUpstreams,
|
PassthroughBackends: passUpstreams,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ic.runningConfig != nil && ic.runningConfig.Equal(&pcfg) {
|
if !ic.configmapChanged && (ic.runningConfig != nil && ic.runningConfig.Equal(&pcfg)) {
|
||||||
glog.V(3).Infof("skipping backend reload (no changes detected)")
|
glog.V(3).Infof("skipping backend reload (no changes detected)")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -427,6 +433,7 @@ func (ic *GenericController) syncIngress(key interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ic.configmapChanged = false
|
||||||
glog.Infof("ingress backend successfully reloaded...")
|
glog.Infof("ingress backend successfully reloaded...")
|
||||||
incReloadCount()
|
incReloadCount()
|
||||||
setSSLExpireTime(servers)
|
setSSLExpireTime(servers)
|
||||||
|
|
Loading…
Reference in a new issue