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

Use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources #33763

Conversation

tetianakravchenko
Copy link
Contributor

@tetianakravchenko tetianakravchenko commented Nov 22, 2022

What does this PR do?

Add namespace metadata to all namespaced resources such as deployment, replicates, jobs, cronjob, statefulset and daemonset, etc.

related PR - elastic/elastic-agent-autodiscover#33

Note: after this change all labels of the namespace, where the resource is running, will be added to resource

Why is it important?

#33108

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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Memory usage of metricbeat after introducing this change comparing to the main branch:
Screenshot 2022-11-22 at 17 00 42

namespace labels on statefulset resource:
Screenshot 2022-11-22 at 17 33 19

persistentvolume - nothing changed as this resource is not namespaced
Screenshot 2022-11-22 at 17 34 53

Logs

@tetianakravchenko tetianakravchenko requested review from faec and leehinman and removed request for a team November 22, 2022 16:27
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 22, 2022
@mergify
Copy link
Contributor

mergify bot commented Nov 22, 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 k8s-metricsets-add-resource-meta upstream/k8s-metricsets-add-resource-meta
git merge upstream/main
git push upstream k8s-metricsets-add-resource-meta

@mergify
Copy link
Contributor

mergify bot commented Nov 22, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @tetianakravchenko? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 22, 2022

💚 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-12-07T08:48:59.721+0000

  • Duration: 129 min 20 sec

Test stats 🧪

Test Results
Failed 0
Passed 24485
Skipped 1805
Total 26290

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the 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!)

@mergify
Copy link
Contributor

mergify bot commented Nov 22, 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 k8s-metricsets-add-resource-meta upstream/k8s-metricsets-add-resource-meta
git merge upstream/main
git push upstream k8s-metricsets-add-resource-meta

@tetianakravchenko tetianakravchenko requested a review from a team November 23, 2022 10:26
@tetianakravchenko tetianakravchenko added the Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team label Nov 23, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 23, 2022
@gizas
Copy link
Contributor

gizas commented Nov 24, 2022

…rator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
@mergify
Copy link
Contributor

mergify bot commented Nov 28, 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 k8s-metricsets-add-resource-meta upstream/k8s-metricsets-add-resource-meta
git merge upstream/main
git push upstream k8s-metricsets-add-resource-meta

@tetianakravchenko
Copy link
Contributor Author

/package

@tetianakravchenko
Copy link
Contributor Author

tetianakravchenko commented Nov 29, 2022

Regarding failing golangci-lint: I can't reproduce those error and locally I am getting only warnings:

 mage llc
WARN [linters context] bodyclose is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] nilerr is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] noctx is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] structcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] wastedassign is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.

used the same go verions as in project:

go version
go version go1.18.8 darwin/amd64

that seems to be related to some of the golangci/golangci-lint-action@v3 dependencies

@tetianakravchenko tetianakravchenko added backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.5.0 Automated backport with mergify backport-v8.6.0 Automated backport with mergify labels Nov 29, 2022
@mergify
Copy link
Contributor

mergify bot commented Nov 30, 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 k8s-metricsets-add-resource-meta upstream/k8s-metricsets-add-resource-meta
git merge upstream/main
git push upstream k8s-metricsets-add-resource-meta

@mergify
Copy link
Contributor

mergify bot commented Dec 6, 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 k8s-metricsets-add-resource-meta upstream/k8s-metricsets-add-resource-meta
git merge upstream/main
git push upstream k8s-metricsets-add-resource-meta

@sonarcloud
Copy link

sonarcloud bot commented Dec 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.2% 0.2% Duplication

@tetianakravchenko tetianakravchenko merged commit 951b244 into elastic:main Dec 7, 2022
mergify bot pushed a commit that referenced this pull request Dec 7, 2022
…sources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	metricbeat/docs/modules/kubernetes.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/kubernetes/_meta/config.reference.yml
#	metricbeat/module/kubernetes/_meta/config.yml
#	metricbeat/modules.d/kubernetes.yml.disabled
#	x-pack/metricbeat/metricbeat.reference.yml
mergify bot pushed a commit that referenced this pull request Dec 7, 2022
…sources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
mergify bot pushed a commit that referenced this pull request Dec 7, 2022
…sources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	go.mod
tetianakravchenko added a commit that referenced this pull request Dec 8, 2022
…l generic kubernetes resources (#33986)

* Use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	go.mod

* fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
Co-authored-by: Tetiana Kravchenko <[email protected]>
dadoonet pushed a commit that referenced this pull request Dec 20, 2022
…sources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	metricbeat/docs/modules/kubernetes.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/kubernetes/_meta/config.reference.yml
#	metricbeat/module/kubernetes/_meta/config.yml
#	metricbeat/modules.d/kubernetes.yml.disabled
#	x-pack/metricbeat/metricbeat.reference.yml
tetianakravchenko added a commit that referenced this pull request Dec 21, 2022
…ll generic kubernetes resources (#33984)

* Use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	metricbeat/docs/modules/kubernetes.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/kubernetes/_meta/config.reference.yml
#	metricbeat/module/kubernetes/_meta/config.yml
#	metricbeat/modules.d/kubernetes.yml.disabled
#	x-pack/metricbeat/metricbeat.reference.yml

* fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* rerun make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* backport changes added in elastic/elastic-agent-autodiscover#33

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix linter

Signed-off-by: Tetiana Kravchenko <[email protected]>

* Use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	metricbeat/docs/modules/kubernetes.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/kubernetes/_meta/config.reference.yml
#	metricbeat/module/kubernetes/_meta/config.yml
#	metricbeat/modules.d/kubernetes.yml.disabled
#	x-pack/metricbeat/metricbeat.reference.yml

* fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* rerun make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* backport changes added in elastic/elastic-agent-autodiscover#33

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix linter

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests and changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
Co-authored-by: Tetiana Kravchenko <[email protected]>
tetianakravchenko added a commit that referenced this pull request Dec 22, 2022
…l generic kubernetes resources (#33985)

* Use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 951b244)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum

* fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
Co-authored-by: Tetiana Kravchenko <[email protected]>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
…sources (#33763)

* update elastic-agent-autodiscover; use NamespaceAwareResourceMetaGenerator for all generic kubernetes resources

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update configuration comments

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add PR number; fix conflicts

Signed-off-by: Tetiana Kravchenko <[email protected]>

* run make notice

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix go.sum file after rebase

Signed-off-by: Tetiana Kravchenko <[email protected]>

* make update

Signed-off-by: Tetiana Kravchenko <[email protected]>

* clean up changelog

Signed-off-by: Tetiana Kravchenko <[email protected]>

* test llc

Signed-off-by: Tetiana Kravchenko <[email protected]>

* revert local test

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
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 backport-v8.5.0 Automated backport with mergify backport-v8.6.0 Automated backport with mergify Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants