Skip to content

Commit 140474c

Browse files
committed
add appropriate RBAC for the role-sync-controller
1 parent 9da70d6 commit 140474c

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

cluster/manifests/deletions.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ post_apply:
313313
- name: role-sync-controller
314314
kind: CronJob
315315
namespace: kube-system
316+
- name: role-sync-controller
317+
kind: ClusterRole
316318
- name: role-sync-controller
317319
kind: ClusterRoleBinding
318320
- name: role-sync-controller

cluster/manifests/role-sync-controller/rbac.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
{{ if eq .Cluster.ConfigItems.role_sync_controller_enabled "true" }}
22
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: role-sync-controller
6+
labels:
7+
application: kubernetes
8+
component: role-sync-controller
9+
rules:
10+
# Allow the controller to list namespaces
11+
- apiGroups:
12+
- ""
13+
resources:
14+
- "namespaces"
15+
verbs:
16+
- "list"
17+
# Allow the controller to manage Roles and Rolebindings
18+
- apiGroups:
19+
- rbac.authorization.k8s.io
20+
resources:
21+
- roles
22+
- rolebindings
23+
verbs:
24+
- "get"
25+
- "create"
26+
- "update"
27+
# Allow the controller to manage roles based on reading Secrets
28+
- apiGroups:
29+
- ""
30+
resources:
31+
- secrets
32+
verbs:
33+
- "get"
34+
- "list"
35+
- "watch"
36+
---
37+
apiVersion: rbac.authorization.k8s.io/v1
338
kind: ClusterRoleBinding
439
metadata:
540
name: role-sync-controller
@@ -9,7 +44,7 @@ metadata:
944
roleRef:
1045
apiGroup: rbac.authorization.k8s.io
1146
kind: ClusterRole
12-
name: poweruser
47+
name: role-sync-controller
1348
subjects:
1449
- kind: ServiceAccount
1550
name: role-sync-controller

0 commit comments

Comments
 (0)