|
| 1 | +# This YAML file contains all RBAC objects that are necessary to run external |
| 2 | +# CSI provisioner. |
| 3 | +# |
| 4 | +# In production, each CSI driver deployment has to be customized: |
| 5 | +# - to avoid conflicts, use non-default namespace and different names |
| 6 | +# for non-namespaced entities like the ClusterRole |
| 7 | +# - decide whether the deployment replicates the external CSI |
| 8 | +# provisioner, in which case leadership election must be enabled; |
| 9 | +# this influences the RBAC setup, see below |
| 10 | + |
| 11 | +apiVersion: v1 |
| 12 | +kind: ServiceAccount |
| 13 | +metadata: |
| 14 | + name: csi-provisioner |
| 15 | + # replace with non-default namespace name |
| 16 | + namespace: default |
| 17 | + |
| 18 | +--- |
| 19 | +kind: ClusterRole |
| 20 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 21 | +metadata: |
| 22 | + name: external-provisioner-runner |
| 23 | +rules: |
| 24 | + - apiGroups: [""] |
| 25 | + resources: ["secrets"] |
| 26 | + verbs: ["get", "list"] |
| 27 | + - apiGroups: [""] |
| 28 | + resources: ["persistentvolumes"] |
| 29 | + verbs: ["get", "list", "watch", "create", "delete"] |
| 30 | + - apiGroups: [""] |
| 31 | + resources: ["persistentvolumeclaims"] |
| 32 | + verbs: ["get", "list", "watch", "update"] |
| 33 | + - apiGroups: ["storage.k8s.io"] |
| 34 | + resources: ["storageclasses"] |
| 35 | + verbs: ["get", "list", "watch"] |
| 36 | + - apiGroups: [""] |
| 37 | + resources: ["events"] |
| 38 | + verbs: ["list", "watch", "create", "update", "patch"] |
| 39 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 40 | + resources: ["volumesnapshots"] |
| 41 | + verbs: ["get", "list"] |
| 42 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 43 | + resources: ["volumesnapshotcontents"] |
| 44 | + verbs: ["get", "list"] |
| 45 | + |
| 46 | +--- |
| 47 | +kind: ClusterRoleBinding |
| 48 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 49 | +metadata: |
| 50 | + name: csi-provisioner-role |
| 51 | +subjects: |
| 52 | + - kind: ServiceAccount |
| 53 | + name: csi-provisioner |
| 54 | + # replace with non-default namespace name |
| 55 | + namespace: default |
| 56 | +roleRef: |
| 57 | + kind: ClusterRole |
| 58 | + name: external-provisioner-runner |
| 59 | + apiGroup: rbac.authorization.k8s.io |
| 60 | + |
| 61 | +--- |
| 62 | +# Provisioner must be able to work with endpoints in current namespace |
| 63 | +# if (and only if) leadership election is enabled |
| 64 | +kind: Role |
| 65 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 66 | +metadata: |
| 67 | + # replace with non-default namespace name |
| 68 | + namespace: default |
| 69 | + name: external-provisioner-cfg |
| 70 | +rules: |
| 71 | +- apiGroups: [""] |
| 72 | + resources: ["endpoints"] |
| 73 | + verbs: ["get", "watch", "list", "delete", "update", "create"] |
| 74 | + |
| 75 | +--- |
| 76 | +kind: RoleBinding |
| 77 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 78 | +metadata: |
| 79 | + name: csi-provisioner-role-cfg |
| 80 | + # replace with non-default namespace name |
| 81 | + namespace: default |
| 82 | +subjects: |
| 83 | + - kind: ServiceAccount |
| 84 | + name: csi-provisioner |
| 85 | + # replace with non-default namespace name |
| 86 | + namespace: default |
| 87 | +roleRef: |
| 88 | + kind: Role |
| 89 | + name: external-provisioner-cfg |
0 commit comments