Skip to content

Commit 10ea526

Browse files
committed
fixes and changelog
Signed-off-by: chrismark <chrismarkou92@gmail.com>
1 parent 8338da4 commit 10ea526

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
598598
- Update the baseline version of Sarama (Kafka support library) to 1.27.2. {pull}23595[23595]
599599
- Add kubernetes.volume.fs.used.pct field. {pull}23564[23564]
600600
- Add the `enable_krb5_fast` flag to the Kafka output to explicitly opt-in to FAST authentication. {pull}23629[23629]
601+
- Add deployment name in pod's meta. {pull}23610[23610]
601602

602603
*Auditbeat*
603604

libbeat/common/kubernetes/metadata/pod.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ func (p *pod) Generate(obj kubernetes.Resource, opts ...FieldOptions) common.Map
6363

6464
// check if Pod is handled by a ReplicaSet which is controlled by a Deployment
6565
rsName, _ := out.GetValue("replicaset.name")
66-
if rsName != nil {
67-
rsName := rsName.(string)
66+
if rsName, ok := rsName.(string); ok {
6867
dep := p.getRSDeployment(rsName, po.GetNamespace())
6968
if dep != "" {
7069
out.Put("deployment.name", dep)
@@ -114,6 +113,9 @@ func (p *pod) GenerateFromName(name string, opts ...FieldOptions) common.MapStr
114113
// getRSDeployment return the name of the Deployment object that
115114
// owns the ReplicaSet with the given name under the given Namespace
116115
func (p *pod) getRSDeployment(rsName string, ns string) string {
116+
if p.client == nil {
117+
return ""
118+
}
117119
rs, err := p.client.AppsV1().ReplicaSets(ns).Get(context.TODO(), rsName, metav1.GetOptions{})
118120
if err != nil {
119121
return ""

libbeat/common/kubernetes/metadata/pod_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestPod_Generate(t *testing.T) {
8787
},
8888
}
8989

90-
_, err := client.AppsV1().ReplicaSets(namespace).Create(context.TODO(), rs, metav1.CreateOptions{})
90+
_, err := client.AppsV1().ReplicaSets(namespace).Create(context.Background(), rs, metav1.CreateOptions{})
9191
if err != nil {
9292
t.Fatalf("failed to create k8s deployment: %v", err)
9393
}

0 commit comments

Comments
 (0)