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: Add /metrics non-resource URL to rbac #2913

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func (o *K8sAttributesParser) GetRBACRules() []rbacv1.PolicyRule {
Resources: []string{"replicasets"},
Verbs: []string{"get", "watch", "list"},
},
{
NonResourceURLs: []string{"/metrics"},
Copy link
Member

Choose a reason for hiding this comment

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

By adding this non-resource URL to the RBAC, it becomes possible for an OTEL collector to scrape authenticated endpoints such as control plane components.

@thefirstofthe300 this file creates RBAC for the k8sattribute processor. This does not seem to be related to metrics

Copy link
Member

Choose a reason for hiding this comment

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

or maybe I am missing something here

Verbs: []string{"get"},
},
}

extractCfg, ok := o.config["extract"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func TestK8sAttributesRBAC(t *testing.T) {
Resources: []string{"replicasets"},
Verbs: []string{"get", "watch", "list"},
},
{
NonResourceURLs: []string{"/metrics"},
Verbs: []string{"get"},
},
},
},
{
Expand All @@ -67,6 +71,10 @@ func TestK8sAttributesRBAC(t *testing.T) {
Resources: []string{"replicasets"},
Verbs: []string{"get", "watch", "list"},
},
{
NonResourceURLs: []string{"/metrics"},
Verbs: []string{"get"},
},
{
APIGroups: []string{""},
Resources: []string{"nodes"},
Expand Down