Remove event duplication and check ingress before annotation extraction

This commit is contained in:
Manuel de Brito Fontes 2018-01-23 20:38:27 -03:00 committed by Manuel Alejandro de Brito Fontes
parent 62622f6516
commit 0836cb30aa

View file

@ -355,8 +355,10 @@ func New(checkOCSP bool,
glog.Infof("secret %v was removed and it is used in ingress annotations. Parsing...", key) glog.Infof("secret %v was removed and it is used in ingress annotations. Parsing...", key)
for _, name := range set.List() { for _, name := range set.List() {
ing, _ := store.GetIngress(name) ing, _ := store.GetIngress(name)
if ing != nil {
store.extractAnnotations(ing) store.extractAnnotations(ing)
} }
}
updateCh <- Event{ updateCh <- Event{
Type: ConfigurationEvent, Type: ConfigurationEvent,
@ -399,7 +401,7 @@ func New(checkOCSP bool,
glog.V(2).Infof("adding configmap %v to backend", mapKey) glog.V(2).Infof("adding configmap %v to backend", mapKey)
store.setConfig(m) store.setConfig(m)
updateCh <- Event{ updateCh <- Event{
Type: CreateEvent, Type: ConfigurationEvent,
Obj: obj, Obj: obj,
} }
} }
@ -409,7 +411,7 @@ func New(checkOCSP bool,
m := cur.(*apiv1.ConfigMap) m := cur.(*apiv1.ConfigMap)
mapKey := fmt.Sprintf("%s/%s", m.Namespace, m.Name) mapKey := fmt.Sprintf("%s/%s", m.Namespace, m.Name)
if mapKey == configmap { if mapKey == configmap {
glog.V(2).Infof("updating configmap backend (%v)", mapKey) recorder.Eventf(m, apiv1.EventTypeNormal, "UPDATE", fmt.Sprintf("ConfigMap %v", mapKey))
store.setConfig(m) store.setConfig(m)
updateCh <- Event{ updateCh <- Event{
Type: ConfigurationEvent, Type: ConfigurationEvent,
@ -417,7 +419,7 @@ func New(checkOCSP bool,
} }
} }
// updates to configuration configmaps can trigger an update // updates to configuration configmaps can trigger an update
if mapKey == configmap || mapKey == tcp || mapKey == udp { if mapKey == tcp || mapKey == udp {
recorder.Eventf(m, apiv1.EventTypeNormal, "UPDATE", fmt.Sprintf("ConfigMap %v", mapKey)) recorder.Eventf(m, apiv1.EventTypeNormal, "UPDATE", fmt.Sprintf("ConfigMap %v", mapKey))
updateCh <- Event{ updateCh <- Event{
Type: ConfigurationEvent, Type: ConfigurationEvent,