Skip to content

Commit

Permalink
Handle DeletedFinalStateUnknown in k8s OnDelete (elastic#23419)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6d43535)
  • Loading branch information
ChrsMark committed Jan 12, 2021
1 parent bdaf54b commit bc9b150
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Use PROGRAMDATA environment variable instead of C:\ProgramData for windows install service {pull}22874[22874]
- Fix reporting of cgroup metrics when running under Docker {pull}22879[22879]
- Fix typo in config docs {pull}23185[23185]
- Fix `nested` subfield handling in generated Elasticsearch templates. {issue}23178[23178] {pull}23183[23183]
- Fix CPU usage metrics on VMs with dynamic CPU config {pull}23154[23154]
- Fix panic due to unhandled DeletedFinalStateUnknown in k8s OnDelete {pull}23419[23419]

*Auditbeat*

Expand Down
3 changes: 1 addition & 2 deletions libbeat/autodiscover/providers/kubernetes/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import (
"fmt"
"time"

"github.com/elastic/beats/v7/libbeat/common/kubernetes/metadata"

"github.com/gofrs/uuid"
k8s "k8s.io/client-go/kubernetes"

"github.com/elastic/beats/v7/libbeat/autodiscover/builder"
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/common/bus"
"github.com/elastic/beats/v7/libbeat/common/kubernetes"
"github.com/elastic/beats/v7/libbeat/common/kubernetes/metadata"
"github.com/elastic/beats/v7/libbeat/common/safemapstr"
"github.com/elastic/beats/v7/libbeat/logp"
)
Expand Down
4 changes: 4 additions & 0 deletions libbeat/common/kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func (w *watcher) enqueue(obj interface{}, state string) {
if err != nil {
return
}
if deleted, ok := obj.(cache.DeletedFinalStateUnknown); ok {
w.logger.Debugf("Enqueued DeletedFinalStateUnknown contained object: %+v", deleted.Obj)
obj = deleted.Obj
}
w.queue.Add(&item{key, obj, state})
}

Expand Down

0 comments on commit bc9b150

Please sign in to comment.