Skip to content

Commit

Permalink
add_kubernetes_metadata: Do not process nil pod events (#6487)
Browse files Browse the repository at this point in the history
While the root cause is unclear, this change adds defensive code against
nil Pod processing errors. It also adds more logging to debug this
further.

Fixes #6372
  • Loading branch information
exekias authored and ruflin committed Mar 2, 2018
1 parent cdbd8bc commit 87bfbd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ https://github.com/elastic/beats/compare/v6.2.2...6.2[Check the HEAD diff]

*Affecting all Beats*

- Avoid panic errors when processing nil Pod events in add_kubernetes_metadata. {issue}6372[6372]

*Auditbeat*

*Filebeat*
Expand Down
4 changes: 2 additions & 2 deletions libbeat/processors/add_kubernetes_metadata/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func (k *kubernetesAnnotator) worker() {
// Run pod actions while handling errors
func processEvent(f func(pod *kubernetes.Pod), event bus.Event) {
pod, ok := event["pod"].(*kubernetes.Pod)
if !ok {
logp.Err("Couldn't get a pod from watcher event")
if !ok || pod == nil {
logp.Err("Couldn't get a pod from watcher event: %v", event)
return
}
f(pod)
Expand Down

0 comments on commit 87bfbd7

Please sign in to comment.