Skip to content

Commit 2c12002

Browse files
committed
fix: add metrics auth RBAC to rbac_deployment component
Add metrics_auth_role and metrics_auth_role_binding to the rbac_deployment kustomize Component so the operator SA can perform TokenReview and SubjectAccessReview for metrics authentication. Without this RBAC, the controller-runtime metrics filter cannot validate bearer tokens from VMAgent, causing all scrape requests to fail with 401.
1 parent 004676e commit 2c12002

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

config/rbac_deployment/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ kind: Component
33
resources:
44
- leader_election_role.yaml
55
- leader_election_role_binding.yaml
6+
- metrics_auth_role.yaml
7+
- metrics_auth_role_binding.yaml
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: metrics-auth-role
5+
rules:
6+
- apiGroups:
7+
- authentication.k8s.io
8+
resources:
9+
- tokenreviews
10+
verbs:
11+
- create
12+
- apiGroups:
13+
- authorization.k8s.io
14+
resources:
15+
- subjectaccessreviews
16+
verbs:
17+
- create
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: metrics-auth-rolebinding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: metrics-auth-role
9+
subjects:
10+
- kind: ServiceAccount
11+
name: controller-manager
12+
namespace: system

0 commit comments

Comments
 (0)