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

Add automatic RBAC creation for k8sevents receiver #3421

Merged
merged 6 commits into from
Nov 8, 2024

Conversation

iblancasa
Copy link
Contributor

Link to tracking Issue(s):

@iblancasa iblancasa self-assigned this Nov 5, 2024
@iblancasa iblancasa requested a review from a team as a code owner November 5, 2024 17:19

func generatek8seventsRbacRules(_ logr.Logger, _ k8seventsConfig) ([]rbacv1.PolicyRule, error) {
// The k8s Events Receiver needs get permissions on the following resources always.
return []rbacv1.PolicyRule{
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know why this component requires all of these permissions? It looks like it only sets a watch on Events themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just followed the component documentation: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/k8seventsreceiver/README.md#rbac

I agree they are a lot. Maybe I can work on the future in the contrib repo to see if we really need that, fix the documentation and fix the permissions where. WDYT?

@iblancasa
Copy link
Contributor Author

Can we merge this?

@swiatekm swiatekm merged commit 0ff706a into open-telemetry:main Nov 8, 2024
38 checks passed
debug:
service:
pipelines:
traces:
Copy link

Choose a reason for hiding this comment

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

This shouldn't work and should fail with Error: failed to build pipelines: failed to create "k8s_events" receiver for data type "traces": telemetry type is not supported.

I wonder if this is the reason why no CR/CRB is created if I deploy exactly this manifest, but with logs instead of traces?

Copy link

Choose a reason for hiding this comment

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

Nevermind, my operator SA was missing permissions... but this typo is legit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Worth fixing, but for the purpose of this test it doesn't matter. We don't even care if the collector starts, just that the generated ClusterRole is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic RBAC support for k8sevents receiver
3 participants