Merge pull request #5052 from janosi/cm-add-event
Change the handling of ConfigMap creation
This commit is contained in:
commit
fc41dc732a
1 changed files with 25 additions and 4 deletions
|
@ -535,19 +535,40 @@ func New(
|
|||
AddFunc: func(obj interface{}) {
|
||||
cm := obj.(*corev1.ConfigMap)
|
||||
key := k8s.MetaNamespaceKey(cm)
|
||||
|
||||
triggerUpdate := false
|
||||
|
||||
// updates to configuration configmaps can trigger an update
|
||||
if changeTriggerUpdate(key) {
|
||||
recorder.Eventf(cm, corev1.EventTypeNormal, "CREATE", fmt.Sprintf("ConfigMap %v", key))
|
||||
|
||||
triggerUpdate = true
|
||||
if key == configmap {
|
||||
store.setConfig(cm)
|
||||
}
|
||||
}
|
||||
|
||||
ings := store.listers.IngressWithAnnotation.List()
|
||||
for _, ingKey := range ings {
|
||||
key := k8s.MetaNamespaceKey(ingKey)
|
||||
ing, err := store.getIngress(key)
|
||||
if err != nil {
|
||||
klog.Errorf("could not find Ingress %v in local store: %v", key, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if parser.AnnotationsReferencesConfigmap(ing) {
|
||||
recorder.Eventf(cm, corev1.EventTypeNormal, "CREATE", fmt.Sprintf("ConfigMap %v", key))
|
||||
store.syncIngress(ing)
|
||||
triggerUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
if triggerUpdate {
|
||||
updateCh.In() <- Event{
|
||||
Type: ConfigurationEvent,
|
||||
Obj: obj,
|
||||
}
|
||||
}
|
||||
},
|
||||
UpdateFunc: func(old, cur interface{}) {
|
||||
if reflect.DeepEqual(old, cur) {
|
||||
|
|
Loading…
Reference in a new issue