From 0836cb30aad9cbcb544c055df5864f056a7d40f1 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Tue, 23 Jan 2018 20:38:27 -0300 Subject: [PATCH] Remove event duplication and check ingress before annotation extraction --- internal/ingress/controller/store/store.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/ingress/controller/store/store.go b/internal/ingress/controller/store/store.go index cf9bc8582a..59f4767201 100644 --- a/internal/ingress/controller/store/store.go +++ b/internal/ingress/controller/store/store.go @@ -355,7 +355,9 @@ func New(checkOCSP bool, glog.Infof("secret %v was removed and it is used in ingress annotations. Parsing...", key) for _, name := range set.List() { ing, _ := store.GetIngress(name) - store.extractAnnotations(ing) + if ing != nil { + store.extractAnnotations(ing) + } } updateCh <- Event{ @@ -399,7 +401,7 @@ func New(checkOCSP bool, glog.V(2).Infof("adding configmap %v to backend", mapKey) store.setConfig(m) updateCh <- Event{ - Type: CreateEvent, + Type: ConfigurationEvent, Obj: obj, } } @@ -409,7 +411,7 @@ func New(checkOCSP bool, m := cur.(*apiv1.ConfigMap) mapKey := fmt.Sprintf("%s/%s", m.Namespace, m.Name) 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) updateCh <- Event{ Type: ConfigurationEvent, @@ -417,7 +419,7 @@ func New(checkOCSP bool, } } // 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)) updateCh <- Event{ Type: ConfigurationEvent,