Skip to content

Commit

Permalink
Fix Configmap/Mergeable Ingress Add/Update event logging (#386)
Browse files Browse the repository at this point in the history
* Fix Ingress addOrUpdate ConfigMap warning events
* Fix ConfigMap addOrUpdate warning events
* Bug introduced in: cca1389

* Changed the logged bug to reference the correct variable
* Built the eventMessage string prior to log to preserve code structure while not
printing errs when they are nil
  • Loading branch information
Dean-Coakley authored Oct 2, 2018
1 parent aa0f464 commit b561c62
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,22 +368,22 @@ func (lbc *LoadBalancerController) syncConfig(task queue.Task) {
if updateErr != nil {
eventTitle = "UpdatedWithError"
eventType = api_v1.EventTypeWarning
eventWarningMessage = "but was not applied"
eventWarningMessage = fmt.Sprintf("but was not applied: %v", updateErr)
}
if configExists {
cfgm := obj.(*api_v1.ConfigMap)
lbc.recorder.Eventf(cfgm, eventType, eventTitle, "Configuration from %v was updated %s: %v", key, eventWarningMessage, err)
lbc.recorder.Eventf(cfgm, eventType, eventTitle, "Configuration from %v was updated %s", key, eventWarningMessage)
}
for _, ingEx := range ingExes {
lbc.recorder.Eventf(ingEx.Ingress, eventType, eventTitle, "Configuration for %v/%v was updated %s: %v",
ingEx.Ingress.Namespace, ingEx.Ingress.Name, eventWarningMessage, err)
lbc.recorder.Eventf(ingEx.Ingress, eventType, eventTitle, "Configuration for %v/%v was updated %s",
ingEx.Ingress.Namespace, ingEx.Ingress.Name, eventWarningMessage)
}
for _, mergeableIng := range mergeableIngresses {
master := mergeableIng.Master
lbc.recorder.Eventf(master.Ingress, eventType, eventTitle, "Configuration for %v/%v(Master) was updated %s: %v", master.Ingress.Namespace, master.Ingress.Name, eventWarningMessage, err)
lbc.recorder.Eventf(master.Ingress, eventType, eventTitle, "Configuration for %v/%v(Master) was updated %s", master.Ingress.Namespace, master.Ingress.Name, eventWarningMessage)
for _, minion := range mergeableIng.Minions {
lbc.recorder.Eventf(minion.Ingress, eventType, eventTitle, "Configuration for %v/%v(Minion) was updated %s: %v",
minion.Ingress.Namespace, minion.Ingress.Name, eventWarningMessage, err)
lbc.recorder.Eventf(minion.Ingress, eventType, eventTitle, "Configuration for %v/%v(Minion) was updated %s",
minion.Ingress.Namespace, minion.Ingress.Name, eventWarningMessage)
}
}
}
Expand Down Expand Up @@ -533,11 +533,11 @@ func (lbc *LoadBalancerController) syncIng(task queue.Task) {
if addErr != nil {
eventTitle = "AddedOrUpdatedWithError"
eventType = api_v1.EventTypeWarning
eventWarningMessage = "but was not applied"
eventWarningMessage = fmt.Sprintf("but was not applied: %v", addErr)
}
lbc.recorder.Eventf(ing, eventType, eventTitle, "Configuration for %v(Master) was added or updated %s: %v", key, eventWarningMessage, err)
lbc.recorder.Eventf(ing, eventType, eventTitle, "Configuration for %v(Master) was added or updated %s", key, eventWarningMessage)
for _, minion := range mergeableIngExs.Minions {
lbc.recorder.Eventf(ing, eventType, eventTitle, "Configuration for %v/%v(Minion) was added or updated %s: %v", minion.Ingress.Namespace, minion.Ingress.Name, eventWarningMessage, err)
lbc.recorder.Eventf(ing, eventType, eventTitle, "Configuration for %v/%v(Minion) was added or updated %s", minion.Ingress.Namespace, minion.Ingress.Name, eventWarningMessage)
}

if lbc.reportStatusEnabled() {
Expand Down

0 comments on commit b561c62

Please sign in to comment.