Skip to content

Commit f8b8131

Browse files
authored
Merge pull request #171 from davidz627/feature/clusterRoleYAMLS
Added explicit cluster roles for external csi components because system roles deprecated
2 parents 7c26518 + 47a05d2 commit f8b8131

File tree

1 file changed

+67
-19
lines changed

1 file changed

+67
-19
lines changed

deploy/kubernetes/base/setup-cluster.yaml

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1+
##### Node Service Account, Roles, RoleBindings
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: csi-node-sa
6+
7+
---
8+
19
kind: ClusterRole
210
apiVersion: rbac.authorization.k8s.io/v1
311
metadata:
412
name: driver-registrar-role
513
rules:
6-
- apiGroups: [""]
7-
resources: ["nodes"]
8-
verbs: ["get", "update"]
914
- apiGroups: [""]
1015
resources: ["events"]
11-
verbs: ["list", "watch", "create", "update", "patch"]
16+
verbs: ["get", "list", "watch", "create", "update", "patch"]
1217

13-
---
14-
15-
apiVersion: v1
16-
kind: ServiceAccount
17-
metadata:
18-
name: csi-node-sa
1918

2019
---
2120

2221
kind: ClusterRoleBinding
2322
apiVersion: rbac.authorization.k8s.io/v1
2423
metadata:
25-
name: driver-reigstrar-binding
24+
name: driver-registrar-binding
2625
subjects:
2726
- kind: ServiceAccount
2827
name: csi-node-sa
@@ -33,48 +32,97 @@ roleRef:
3332
apiGroup: rbac.authorization.k8s.io
3433

3534
---
36-
35+
##### Controller Service Account, Roles, Rolebindings
3736
apiVersion: v1
3837
kind: ServiceAccount
3938
metadata:
4039
name: csi-controller-sa
4140

41+
---
42+
# xref: https://github.com/kubernetes-csi/external-provisioner/blob/master/deploy/kubernetes/rbac.yaml
43+
kind: ClusterRole
44+
apiVersion: rbac.authorization.k8s.io/v1
45+
metadata:
46+
name: external-provisioner-role
47+
rules:
48+
- apiGroups: [""]
49+
resources: ["secrets"]
50+
verbs: ["get", "list"]
51+
- apiGroups: [""]
52+
resources: ["persistentvolumes"]
53+
verbs: ["get", "list", "watch", "create", "delete"]
54+
- apiGroups: [""]
55+
resources: ["persistentvolumeclaims"]
56+
verbs: ["get", "list", "watch", "update"]
57+
- apiGroups: ["storage.k8s.io"]
58+
resources: ["storageclasses"]
59+
verbs: ["get", "list", "watch"]
60+
- apiGroups: [""]
61+
resources: ["events"]
62+
verbs: ["list", "watch", "create", "update", "patch"]
63+
- apiGroups: ["snapshot.storage.k8s.io"]
64+
resources: ["volumesnapshots"]
65+
verbs: ["get", "list"]
66+
- apiGroups: ["snapshot.storage.k8s.io"]
67+
resources: ["volumesnapshotcontents"]
68+
verbs: ["get", "list"]
69+
4270
---
4371

4472
kind: ClusterRoleBinding
4573
apiVersion: rbac.authorization.k8s.io/v1
4674
metadata:
47-
name: csi-controller-attacher-binding
75+
name: csi-controller-provisioner-binding
4876
subjects:
4977
- kind: ServiceAccount
5078
name: csi-controller-sa
5179
namespace: default
5280
roleRef:
5381
kind: ClusterRole
54-
name: system:csi-external-attacher
82+
name: external-provisioner-role
5583
apiGroup: rbac.authorization.k8s.io
84+
85+
---
86+
# xref: https://github.com/kubernetes-csi/external-attacher/blob/master/deploy/kubernetes/rbac.yaml
87+
kind: ClusterRole
88+
apiVersion: rbac.authorization.k8s.io/v1
89+
metadata:
90+
name: external-attacher-role
91+
rules:
92+
- apiGroups: [""]
93+
resources: ["persistentvolumes"]
94+
verbs: ["get", "list", "watch", "update"]
95+
- apiGroups: [""]
96+
resources: ["nodes"]
97+
verbs: ["get", "list", "watch"]
98+
- apiGroups: ["csi.storage.k8s.io"]
99+
resources: ["csinodeinfos"]
100+
verbs: ["get", "list", "watch"]
101+
- apiGroups: ["storage.k8s.io"]
102+
resources: ["volumeattachments"]
103+
verbs: ["get", "list", "watch", "update"]
56104

57105
---
58106

59107
kind: ClusterRoleBinding
60108
apiVersion: rbac.authorization.k8s.io/v1
61109
metadata:
62-
name: csi-controller-provisioner-binding
110+
name: csi-controller-attacher-binding
63111
subjects:
64112
- kind: ServiceAccount
65113
name: csi-controller-sa
66114
namespace: default
67115
roleRef:
68116
kind: ClusterRole
69-
name: system:csi-external-provisioner
117+
name: external-attacher-role
70118
apiGroup: rbac.authorization.k8s.io
71119

72120
---
73-
121+
# xref: https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
74122
apiVersion: rbac.authorization.k8s.io/v1
75123
kind: ClusterRole
76124
metadata:
77-
name: system:csi-external-snapshotter
125+
name: external-snapshotter-role
78126
rules:
79127
- apiGroups: ["snapshot.storage.k8s.io"]
80128
resources: ["volumesnapshotclasses"]
@@ -110,5 +158,5 @@ subjects:
110158
namespace: default
111159
roleRef:
112160
kind: ClusterRole
113-
name: system:csi-external-snapshotter
161+
name: external-snapshotter-role
114162
apiGroup: rbac.authorization.k8s.io

0 commit comments

Comments
 (0)