|
| 1 | +{{- if .Values.csi.snapshotController.enabled -}} |
| 2 | +# RBAC file for the snapshot controller. |
| 3 | +# |
| 4 | +# The snapshot controller implements the control loop for CSI snapshot functionality. |
| 5 | +# It should be installed as part of the base Kubernetes distribution in an appropriate |
| 6 | +# namespace for components implementing base system functionality. For installing with |
| 7 | +# Vanilla Kubernetes, kube-system makes sense for the namespace. |
| 8 | +# |
| 9 | +# Enable this only if your Kubernetes distribution does not bundle the snapshot controller. |
| 10 | +# It should be installed only once per cluster, independent of CSI driver. |
| 11 | + |
| 12 | +apiVersion: v1 |
| 13 | +kind: ServiceAccount |
| 14 | +metadata: |
| 15 | + name: snapshot-controller |
| 16 | + namespace: {{ .Release.Namespace }} |
| 17 | +--- |
| 18 | +kind: ClusterRole |
| 19 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 20 | +metadata: |
| 21 | + name: snapshot-controller-runner |
| 22 | +rules: |
| 23 | + - apiGroups: [""] |
| 24 | + resources: ["persistentvolumes"] |
| 25 | + verbs: ["get", "list", "watch"] |
| 26 | + - apiGroups: [""] |
| 27 | + resources: ["persistentvolumeclaims"] |
| 28 | + verbs: ["get", "list", "watch", "update"] |
| 29 | + - apiGroups: ["storage.k8s.io"] |
| 30 | + resources: ["storageclasses"] |
| 31 | + verbs: ["get", "list", "watch"] |
| 32 | + - apiGroups: [""] |
| 33 | + resources: ["events"] |
| 34 | + verbs: ["list", "watch", "create", "update", "patch"] |
| 35 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 36 | + resources: ["volumesnapshotclasses"] |
| 37 | + verbs: ["get", "list", "watch"] |
| 38 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 39 | + resources: ["volumesnapshotcontents"] |
| 40 | + verbs: ["create", "get", "list", "watch", "update", "delete"] |
| 41 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 42 | + resources: ["volumesnapshots"] |
| 43 | + verbs: ["get", "list", "watch", "update"] |
| 44 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 45 | + resources: ["volumesnapshots/status"] |
| 46 | + verbs: ["update"] |
| 47 | +--- |
| 48 | +kind: ClusterRoleBinding |
| 49 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 50 | +metadata: |
| 51 | + name: snapshot-controller-role |
| 52 | +subjects: |
| 53 | + - kind: ServiceAccount |
| 54 | + name: snapshot-controller-sa |
| 55 | + namespace: {{ .Release.Namespace }} |
| 56 | +roleRef: |
| 57 | + kind: ClusterRole |
| 58 | + # change the name also here if the ClusterRole gets renamed |
| 59 | + name: snapshot-controller-runner |
| 60 | + apiGroup: rbac.authorization.k8s.io |
| 61 | +--- |
| 62 | +kind: Role |
| 63 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 64 | +metadata: |
| 65 | + name: snapshot-controller-leaderelection |
| 66 | + namespace: {{ .Release.Namespace }} |
| 67 | +rules: |
| 68 | +- apiGroups: ["coordination.k8s.io"] |
| 69 | + resources: ["leases"] |
| 70 | + verbs: ["get", "watch", "list", "delete", "update", "create"] |
| 71 | +--- |
| 72 | +kind: RoleBinding |
| 73 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 74 | +metadata: |
| 75 | + name: snapshot-controller-leaderelection |
| 76 | + namespace: {{ .Release.Namespace }} |
| 77 | +subjects: |
| 78 | + - kind: ServiceAccount |
| 79 | + name: snapshot-controller |
| 80 | + namespace: {{ .Release.Namespace }} |
| 81 | +roleRef: |
| 82 | + kind: Role |
| 83 | + name: snapshot-controller-leaderelection |
| 84 | + apiGroup: rbac.authorization.k8s.io |
| 85 | +{{- end }} |
0 commit comments