Skip to content

Commit

Permalink
Move labels and annotations under kubernetes.namespace. (#27917)
Browse files Browse the repository at this point in the history
* Move labels and annotations under kubernetes.namespace.
  • Loading branch information
MichaelKatsoulis authored Oct 11, 2021
1 parent e6839ab commit bb36e72
Show file tree
Hide file tree
Showing 98 changed files with 3,651 additions and 2,391 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove deprecated/undocumented IncludeCreatorMetadata setting from kubernetes metadata config options {pull}28006[28006]
- Remove deprecated fields from kubernetes module {pull}28046[28046]
- Remove deprecated config option aws_partition. {pull}28120[28120]
- Update kubernetes.namespace from keyword to group field and add name, labels, annotations, uuid as its fields {pull}27917[27917]

*Auditbeat*

Expand Down
35 changes: 33 additions & 2 deletions auditbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17322,16 +17322,47 @@ type: ip
--
*`kubernetes.namespace`*::
*`kubernetes.namespace.name`*::
+
--
Kubernetes namespace
Kubernetes namespace name
type: keyword
--
*`kubernetes.namespace.uuid`*::
+
--
Kubernetes namespace uuid
type: keyword
--
*`kubernetes.namespace.labels.*`*::
+
--
Kubernetes namespace labels map
type: object
--
*`kubernetes.namespace.annotations.*`*::
+
--
Kubernetes namespace annotations map
type: object
--
*`kubernetes.node.name`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion auditbeat/include/fields.go

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85721,16 +85721,47 @@ type: ip

--

*`kubernetes.namespace`*::

*`kubernetes.namespace.name`*::
+
--
Kubernetes namespace
Kubernetes namespace name


type: keyword

--

*`kubernetes.namespace.uuid`*::
+
--
Kubernetes namespace uuid


type: keyword

--

*`kubernetes.namespace.labels.*`*::
+
--
Kubernetes namespace labels map


type: object

--

*`kubernetes.namespace.annotations.*`*::
+
--
Kubernetes namespace annotations map


type: object

--

*`kubernetes.node.name`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion filebeat/include/fields.go

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions heartbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14904,16 +14904,47 @@ type: ip
--
*`kubernetes.namespace`*::
*`kubernetes.namespace.name`*::
+
--
Kubernetes namespace
Kubernetes namespace name
type: keyword
--
*`kubernetes.namespace.uuid`*::
+
--
Kubernetes namespace uuid
type: keyword
--
*`kubernetes.namespace.labels.*`*::
+
--
Kubernetes namespace labels map
type: object
--
*`kubernetes.namespace.annotations.*`*::
+
--
Kubernetes namespace annotations map
type: object
--
*`kubernetes.node.name`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion heartbeat/include/fields.go

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions journalbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15249,16 +15249,47 @@ type: ip
--
*`kubernetes.namespace`*::
*`kubernetes.namespace.name`*::
+
--
Kubernetes namespace
Kubernetes namespace name
type: keyword
--
*`kubernetes.namespace.uuid`*::
+
--
Kubernetes namespace uuid
type: keyword
--
*`kubernetes.namespace.labels.*`*::
+
--
Kubernetes namespace labels map
type: object
--
*`kubernetes.namespace.annotations.*`*::
+
--
Kubernetes namespace annotations map
type: object
--
*`kubernetes.node.name`*::
+
--
Expand Down
2 changes: 1 addition & 1 deletion journalbeat/include/fields.go

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions libbeat/autodiscover/providers/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ func (p *pod) GenerateHints(event bus.Event) bus.Event {
}

// Look at all the namespace level default annotations and do a merge with priority going to the pod annotations.
if rawNsAnn, ok := kubeMeta["namespace_annotations"]; ok {
rawNsAnn, err := kubeMeta.GetValue("namespace.annotations")
if err == nil {
namespaceAnnotations, _ := rawNsAnn.(common.MapStr)
if len(namespaceAnnotations) != 0 {
annotations.DeepUpdateNoOverwrite(namespaceAnnotations)
Expand Down Expand Up @@ -381,7 +382,7 @@ func (p *pod) containerPodEvents(flag string, pod *kubernetes.Pod, c *containerI
"runtime": c.runtime,
}
if len(namespaceAnnotations) != 0 {
kubemeta["namespace_annotations"] = namespaceAnnotations
kubemeta.Put("namespace.annotations", namespaceAnnotations)
}

ports := c.spec.Ports
Expand Down Expand Up @@ -433,7 +434,7 @@ func (p *pod) podEvent(flag string, pod *kubernetes.Pod, ports common.MapStr, in
kubemeta = kubemeta.Clone()
kubemeta["annotations"] = annotations
if len(namespaceAnnotations) != 0 {
kubemeta["namespace_annotations"] = namespaceAnnotations
kubemeta.Put("namespace.annotations", namespaceAnnotations)
}

// Don't set a port on the event
Expand Down
Loading

0 comments on commit bb36e72

Please sign in to comment.