Skip to content

Commit

Permalink
Removing runtime from top level
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Mar 10, 2018
1 parent d13d605 commit fff50d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
10 changes: 3 additions & 7 deletions libbeat/autodiscover/providers/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (p *Provider) emitEvents(pod *kubernetes.Pod, flag string, containers []kub
containerstatuses []kubernetes.PodContainerStatus) {
host := pod.Status.PodIP

// Collect all container IDs and runtimes from status information. Kubernetes has both docker and rkt
// Collect all container IDs and runtimes from status information.
containerIDs := map[string]string{}
runtimes := map[string]string{}
for _, c := range containerstatuses {
Expand Down Expand Up @@ -207,14 +207,10 @@ func (p *Provider) generateHints(event bus.Event) bus.Event {

if rawCont, ok := kubeMeta["container"]; ok {
container = rawCont.(common.MapStr)
// This would end up adding a docker|rkt.container entry into the event. This would make sure
// This would end up adding a runtime entry into the event. This would make sure
// that there is not an attempt to spin up a docker input for a rkt container and when a
// rkt input exists it would be natively supported.
if runtime, ok := container["runtime"]; ok {
e[runtime.(string)] = common.MapStr{
"container": container,
}
}
e["container"] = container
}

cname := builder.GetContainerName(container)
Expand Down
20 changes: 8 additions & 12 deletions libbeat/autodiscover/providers/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ func TestGenerateHints(t *testing.T) {
"runtime": "rkt",
},
},
"rkt": common.MapStr{
"container": common.MapStr{
"name": "foobar",
"id": "abc",
"runtime": "rkt",
},
"container": common.MapStr{
"name": "foobar",
"id": "abc",
"runtime": "rkt",
},
},
},
Expand Down Expand Up @@ -112,12 +110,10 @@ func TestGenerateHints(t *testing.T) {
"period": "15s",
},
},
"docker": common.MapStr{
"container": common.MapStr{
"name": "foobar",
"id": "abc",
"runtime": "docker",
},
"container": common.MapStr{
"name": "foobar",
"id": "abc",
"runtime": "docker",
},
},
},
Expand Down

0 comments on commit fff50d8

Please sign in to comment.