Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix annotation enrichment #29605

Conversation

tetianakravchenko
Copy link
Contributor

@tetianakravchenko tetianakravchenko commented Dec 24, 2021

Signed-off-by: Tetiana Kravchenko tetiana.kravchenko@elastic.co

What does this PR do?

node annotations enrichment doesn't work, with the config:

add_resource_metadata:
  node:
    include_annotations: ["test.annotation"]

events were not enriched with nodes annotation metadata

Why is it important?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

  1. Create a kind kubernetes cluster.
  2. run metricbeat (how-to) with k8s configuration:
kubernetes.yml: |-
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      add_resource_metadata:
        node:
          include_annotations: ["another.annotation", "example.annotation"]
      period: 10s
      host: ${NODE_NAME}
      hosts: ["https://${NODE_NAME}:10250"]
      bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
      ssl.verification_mode: "none"
  1. edit kind node so that the list of annotations include another.annotation and example.annotation:
$ kubectl describe node kind-control-plane
...
Annotations:        another.annotation: another
                    example.annotation: example
                    kubeadm.alpha.kubernetes.io/cri-socket: unix:///run/containerd/containerd.sock
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
...

Related issues

Use cases

Screenshots

All node/namespace metadata:
Screenshot 2022-01-05 at 15 11 50

note that annotations metadata were only added to pod and container metricsets:
Screenshot 2022-01-05 at 15 13 22

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 24, 2021
@mergify
Copy link
Contributor

mergify bot commented Dec 24, 2021

This pull request does not have a backport label. Could you fix it @tetianakravchenko? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Dec 24, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Dec 24, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-01-12T11:46:46.538+0000

  • Duration: 105 min 48 sec

  • Commit: 955ab99

Test stats 🧪

Test Results
Failed 0
Passed 47850
Skipped 4284
Total 52134

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@tetianakravchenko tetianakravchenko added bug Team:Integrations Label for the Integrations team labels Dec 24, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 24, 2021
@tetianakravchenko
Copy link
Contributor Author

/package

@mergify
Copy link
Contributor

mergify bot commented Jan 4, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_resource_meta_enrichment upstream/add_resource_meta_enrichment
git merge upstream/master
git push upstream add_resource_meta_enrichment

@MichaelKatsoulis
Copy link
Contributor

@tetianakravchenko great! Could you add some Kibana screenshots with the node annotations being added ?

@tetianakravchenko
Copy link
Contributor Author

@MichaelKatsoulis I've added screenshots and the steps to reproduce test

@tetianakravchenko tetianakravchenko added the backport-7.17 Automated backport to the 7.17 branch with mergify label Jan 5, 2022
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Jan 5, 2022
@@ -29,6 +29,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove Journalbeat. Use `journald` input of Filebeat instead. {pull}29131[29131]
- `include_matches` option of `journald` input no longer accepts a list of string. {pull}29294[29294]
- Add job.name in pods controlled by Jobs {pull}28954[28954]
- Fix annotations enrichment. {pull}29605[29605]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not very descriptive of your change. Something like Enrich kubernetes metadata with node annotations

@tetianakravchenko
Copy link
Contributor Author

/package

1 similar comment
@tetianakravchenko
Copy link
Contributor Author

/package

@mergify
Copy link
Contributor

mergify bot commented Jan 11, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_resource_meta_enrichment upstream/add_resource_meta_enrichment
git merge upstream/master
git push upstream add_resource_meta_enrichment

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
@tetianakravchenko
Copy link
Contributor Author

/package

@tetianakravchenko tetianakravchenko merged commit 2917392 into elastic:master Jan 13, 2022
@tetianakravchenko tetianakravchenko deleted the add_resource_meta_enrichment branch January 13, 2022 09:39
mergify bot pushed a commit that referenced this pull request Jan 13, 2022
* add annotation enrichment

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* add pr number

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* fix tests

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* update changelog message

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* clean up changelog after rebase

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 2917392)

# Conflicts:
#	libbeat/common/kubernetes/metadata/pod_test.go
tetianakravchenko added a commit that referenced this pull request Jan 20, 2022
* Fix annotation enrichment (#29605)

* add annotation enrichment

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* add pr number

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* fix tests

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* update changelog message

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>

* clean up changelog after rebase

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 2917392)

# Conflicts:
#	libbeat/common/kubernetes/metadata/pod_test.go

* Update CHANGELOG.next.asciidoc

* Fix conflict in tests

Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
v1v added a commit that referenced this pull request Jan 28, 2022
* upstream/7.17: (30 commits)
  [7.17](backport #29966) Add the Elastic product origin header when talking to Elasticsearch or Kibana. (#30000)
  [Heartbeat] Change size of data on ICMP packet (#29948) (#29978)
  Add clarification about enableing dashboard loading (#29985) (#29989)
  Improve aws-s3 gzip file detection to avoid false negatives (#29969) (#29974)
  ci: docker login step for pulling then pushing (#29960) (#29963)
  x-pack/auditbeat/module/system/socket: get full length path and arg from /proc when not available from kprobe (#29410) (#29958)
  [Automation] Update elastic stack version to 7.17.0-ab4975a2 for testing (#29956)
  [Automation] Update elastic stack version to 7.17.0-1bd58b32 for testing (#29938)
  [7.17](backport #29913) [Metricbeat] gcp.gke: fix overview dashboard (#29914)
  [7.17](backport #29605) Fix annotation enrichment (#29834)
  [Automation] Update elastic stack version to 7.17.0-e1efbe3a for testing (#29922)
  [Automation] Update elastic stack version to 7.17.0-68da5d12 for testing (#29904)
  [7.17][Heartbeat] Defer monitor / ICMP errors to monitor runtime / ES (backport #29413) (#29896)
  Merge pull request from GHSA-rj4h-hqvq-cc6q
  [7.17](backport #29681) Change docker image from CentOS 7 to Ubuntu 20.04 (#29817)
  Fix YAML indentation in `parsers` examples (#29663) (#29894)
  [Automation] Update elastic stack version to 7.17.0-079761a0 for testing (#29864)
  Fix Filebeat dissect processor field tokenization in documentation (#29680) (#29883)
  Enable require_alias for Bulk requests for all actions when target is a write alias (#29879)
  Update Index template loading guide to use the correct endpoint (#29869) (#29877)
  ...
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
* upstream/7.17: (30 commits)
  [7.17](backport elastic#29966) Add the Elastic product origin header when talking to Elasticsearch or Kibana. (elastic#30000)
  [Heartbeat] Change size of data on ICMP packet (elastic#29948) (elastic#29978)
  Add clarification about enableing dashboard loading (elastic#29985) (elastic#29989)
  Improve aws-s3 gzip file detection to avoid false negatives (elastic#29969) (elastic#29974)
  ci: docker login step for pulling then pushing (elastic#29960) (elastic#29963)
  x-pack/auditbeat/module/system/socket: get full length path and arg from /proc when not available from kprobe (elastic#29410) (elastic#29958)
  [Automation] Update elastic stack version to 7.17.0-ab4975a2 for testing (elastic#29956)
  [Automation] Update elastic stack version to 7.17.0-1bd58b32 for testing (elastic#29938)
  [7.17](backport elastic#29913) [Metricbeat] gcp.gke: fix overview dashboard (elastic#29914)
  [7.17](backport elastic#29605) Fix annotation enrichment (elastic#29834)
  [Automation] Update elastic stack version to 7.17.0-e1efbe3a for testing (elastic#29922)
  [Automation] Update elastic stack version to 7.17.0-68da5d12 for testing (elastic#29904)
  [7.17][Heartbeat] Defer monitor / ICMP errors to monitor runtime / ES (backport elastic#29413) (elastic#29896)
  Merge pull request from GHSA-rj4h-hqvq-cc6q
  [7.17](backport elastic#29681) Change docker image from CentOS 7 to Ubuntu 20.04 (elastic#29817)
  Fix YAML indentation in `parsers` examples (elastic#29663) (elastic#29894)
  [Automation] Update elastic stack version to 7.17.0-079761a0 for testing (elastic#29864)
  Fix Filebeat dissect processor field tokenization in documentation (elastic#29680) (elastic#29883)
  Enable require_alias for Bulk requests for all actions when target is a write alias (elastic#29879)
  Update Index template loading guide to use the correct endpoint (elastic#29869) (elastic#29877)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify bug Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubernetes: missing annotations enrichment
3 participants