SSL expiration metrics cannot be tied to dynamic updates

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-06-05 11:04:27 -04:00
parent 73d7806b48
commit 29489097c9
No known key found for this signature in database
GPG key ID: 786136016A8BA02A

View file

@ -125,11 +125,18 @@ func (n *NGINXController) syncIngress(interface{}) error {
ings := n.store.ListIngresses(nil) ings := n.store.ListIngresses(nil)
hosts, servers, pcfg := n.getConfiguration(ings) hosts, servers, pcfg := n.getConfiguration(ings)
if n.isLeader() {
klog.V(2).Infof("Updating ssl expiration metrics.")
n.metricCollector.SetSSLExpireTime(servers)
}
if n.runningConfig.Equal(pcfg) { if n.runningConfig.Equal(pcfg) {
klog.V(3).Infof("No configuration change detected, skipping backend reload.") klog.V(3).Infof("No configuration change detected, skipping backend reload.")
return nil return nil
} }
n.metricCollector.SetHosts(hosts)
if !n.IsDynamicConfigurationEnough(pcfg) { if !n.IsDynamicConfigurationEnough(pcfg) {
klog.Infof("Configuration changes detected, backend reload required.") klog.Infof("Configuration changes detected, backend reload required.")
@ -147,16 +154,9 @@ func (n *NGINXController) syncIngress(interface{}) error {
return err return err
} }
n.metricCollector.SetHosts(hosts)
klog.Infof("Backend successfully reloaded.") klog.Infof("Backend successfully reloaded.")
n.metricCollector.ConfigSuccess(hash, true) n.metricCollector.ConfigSuccess(hash, true)
n.metricCollector.IncReloadCount() n.metricCollector.IncReloadCount()
if n.isLeader() {
klog.V(2).Infof("Updating ssl expiration metrics.")
n.metricCollector.SetSSLExpireTime(servers)
}
} }
isFirstSync := n.runningConfig.Equal(&ingress.Configuration{}) isFirstSync := n.runningConfig.Equal(&ingress.Configuration{})