Change the handling of ConfigMap creation
When a new CM is created Ingress definitions are checked for reference to the new CM an Ingress sync is triggered if such reference is found.
This commit is contained in:
parent
2c5819e1b3
commit
42ec2cc0ed
1 changed files with 25 additions and 4 deletions
|
@ -535,18 +535,39 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
updateCh.In() <- Event{
|
||||
Type: ConfigurationEvent,
|
||||
Obj: obj,
|
||||
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{}) {
|
||||
|
|
Loading…
Reference in a new issue