@@ -12,45 +12,43 @@ import (
1212 "github.com/open-telemetry/opentelemetry-operator/internal/rbac"
1313)
1414
15- var (
16-
17- // targetAllocatorCRPolicyRules are the policy rules required for the CR functionality.
18- targetAllocatorCRPolicyRules = []* rbacv1.PolicyRule {
19- {
20- APIGroups : []string {"monitoring.coreos.com" },
21- Resources : []string {"servicemonitors" , "podmonitors" },
22- Verbs : []string {"*" },
23- }, {
24- APIGroups : []string {"" },
25- Resources : []string {"nodes" , "nodes/metrics" , "services" , "endpoints" , "pods" , "namespaces" },
26- Verbs : []string {"get" , "list" , "watch" },
27- }, {
28- APIGroups : []string {"" },
29- Resources : []string {"configmaps" },
30- Verbs : []string {"get" },
31- }, {
32- APIGroups : []string {"discovery.k8s.io" },
33- Resources : []string {"endpointslices" },
34- Verbs : []string {"get" , "list" , "watch" },
35- }, {
36- APIGroups : []string {"networking.k8s.io" },
37- Resources : []string {"ingresses" },
38- Verbs : []string {"get" , "list" , "watch" },
39- }, {
40- NonResourceURLs : []string {"/metrics" },
41- Verbs : []string {"get" },
42- }, {
43- NonResourceURLs : []string {"/api" , "/api/*" , "/apis" , "/apis/*" },
44- Verbs : []string {"get" },
45- },
46- }
47- )
15+ // targetAllocatorCRPolicyRules are the policy rules required for the CR functionality.
16+ var targetAllocatorCRPolicyRules = []* rbacv1.PolicyRule {
17+ {
18+ APIGroups : []string {"monitoring.coreos.com" },
19+ Resources : []string {"servicemonitors" , "podmonitors" },
20+ Verbs : []string {"*" },
21+ }, {
22+ APIGroups : []string {"" },
23+ Resources : []string {"nodes" , "nodes/metrics" , "services" , "endpoints" , "pods" , "namespaces" },
24+ Verbs : []string {"get" , "list" , "watch" },
25+ }, {
26+ APIGroups : []string {"" },
27+ Resources : []string {"configmaps" },
28+ Verbs : []string {"get" },
29+ }, {
30+ APIGroups : []string {"discovery.k8s.io" },
31+ Resources : []string {"endpointslices" },
32+ Verbs : []string {"get" , "list" , "watch" },
33+ }, {
34+ APIGroups : []string {"networking.k8s.io" },
35+ Resources : []string {"ingresses" },
36+ Verbs : []string {"get" , "list" , "watch" },
37+ }, {
38+ NonResourceURLs : []string {"/metrics" },
39+ Verbs : []string {"get" },
40+ }, {
41+ NonResourceURLs : []string {"/api" , "/api/*" , "/apis" , "/apis/*" },
42+ Verbs : []string {"get" },
43+ },
44+ }
4845
4946func CheckTargetAllocatorPrometheusCRPolicyRules (
5047 ctx context.Context ,
5148 reviewer * rbac.Reviewer ,
5249 namespace string ,
53- serviceAccountName string ) (warnings []string , err error ) {
50+ serviceAccountName string ,
51+ ) (warnings []string , err error ) {
5452 subjectAccessReviews , err := reviewer .CheckPolicyRules (
5553 ctx ,
5654 serviceAccountName ,
0 commit comments