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

[receiver/k8scluster] add support for observing resources for a specific namespace #35727

Merged

Conversation

bacherfl
Copy link
Contributor

@bacherfl bacherfl commented Oct 10, 2024

Description

This PR extends the k8scluster receiver with an option to limit the observed resources to a specific namespace.

Link to tracking issue

Fixes #9401

Testing

added unit and e2e tests

Documentation

Added section about how to make use of Roles and RoleBindings instead of ClusterRoles and ClusterRoleBindings

@bacherfl bacherfl marked this pull request as ready for review October 17, 2024 11:49
@bacherfl bacherfl requested a review from a team as a code owner October 17, 2024 11:49
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

Let's wait for #36235 to get merged and re-base this one. Meanwhile I'm a bit worried about the changes to the existing tests.

@bacherfl
Copy link
Contributor Author

bacherfl commented Nov 7, 2024

Let's wait for #36235 to get merged and re-base this one. Meanwhile I'm a bit worried about the changes to the existing tests.

agree, i did some changes in the meantime and got the tests working on this PR, but some changes may have been unneccessary - I will try out everything after rebasing and keep the changes as minimal as possible

TylerHelmuth pushed a commit that referenced this pull request Nov 7, 2024
…to 1 (#36235)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Fixes what was described at
#35727 (comment).

After
#36114
the `k8scluster` receiver's e2e tests started showing some flakiness
([example](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11701936581/job/32589392145)).

With this change we ensure that only 1 active job/pod of the cronjob
will be present for the whole lifetime of the test to avoid hitting
timing/scheduling related flakiness.

@bacherfl could you also take a look here?

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: ChrsMark <[email protected]>
pull bot pushed a commit to abaguas/opentelemetry-collector-contrib that referenced this pull request Nov 7, 2024
…to 1 (open-telemetry#36235)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Fixes what was described at
open-telemetry#35727 (comment).

After
open-telemetry#36114
the `k8scluster` receiver's e2e tests started showing some flakiness
([example](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11701936581/job/32589392145)).

With this change we ensure that only 1 active job/pod of the cronjob
will be present for the whole lifetime of the test to avoid hitting
timing/scheduling related flakiness.

@bacherfl could you also take a look here?

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: ChrsMark <[email protected]>
# Conflicts:
#	receiver/k8sclusterreceiver/testdata/e2e/cluster-scoped/expected.yaml
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
@bacherfl
Copy link
Contributor Author

bacherfl commented Nov 8, 2024

Alright this should now be ready again - @ChrsMark I reverted the changes I made earlier in the waitForData function as it turned out with the recent fix being merged they were not required anymore

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

LGTM. Left a nit comment. Thank's @bacherfl!

(it will need a make generate to make the CI happy)

receiver/k8sclusterreceiver/e2e_test.go Show resolved Hide resolved
@ChrsMark ChrsMark added the ready to merge Code review completed; ready to merge by maintainers label Nov 18, 2024
@ChrsMark
Copy link
Member

@TylerHelmuth that should be good to go

@TylerHelmuth TylerHelmuth merged commit ec784fb into open-telemetry:main Nov 18, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Nov 18, 2024
RutvikS-crest pushed a commit to RutvikS-crest/opentelemetry-collector-contrib that referenced this pull request Dec 9, 2024
…fic namespace (open-telemetry#35727)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This PR extends the k8scluster receiver with an option to limit the
observed resources to a specific namespace.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#9401 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

added unit and e2e tests

<!--Describe the documentation added.-->
#### Documentation

Added section about how to make use of Roles and RoleBindings instead of
ClusterRoles and ClusterRoleBindings

---------

Signed-off-by: Florian Bacher <[email protected]>
Co-authored-by: Tyler Helmuth <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…to 1 (open-telemetry#36235)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Fixes what was described at
open-telemetry#35727 (comment).

After
open-telemetry#36114
the `k8scluster` receiver's e2e tests started showing some flakiness
([example](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11701936581/job/32589392145)).

With this change we ensure that only 1 active job/pod of the cronjob
will be present for the whole lifetime of the test to avoid hitting
timing/scheduling related flakiness.

@bacherfl could you also take a look here?

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Signed-off-by: ChrsMark <[email protected]>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…fic namespace (open-telemetry#35727)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This PR extends the k8scluster receiver with an option to limit the
observed resources to a specific namespace.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#9401 

<!--Describe what testing was performed and which tests were added.-->
#### Testing

added unit and e2e tests

<!--Describe the documentation added.-->
#### Documentation

Added section about how to make use of Roles and RoleBindings instead of
ClusterRoles and ClusterRoleBindings

---------

Signed-off-by: Florian Bacher <[email protected]>
Co-authored-by: Tyler Helmuth <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/k8scluster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

k8sclusterreceiver: Fetch namespace scoped metrics from the Master API
5 participants