|  | 
| 1 |  | -# This YAML file contains all API objects that are necessary to run external | 
| 2 |  | -# CSI snapshotter. | 
|  | 1 | +# This YAML file shows how to deploy the CSI snapshotter together | 
|  | 2 | +# with the hostpath CSI driver. It depends on the RBAC rules | 
|  | 3 | +# from rbac.yaml and rbac-external-provisioner.yaml. | 
| 3 | 4 | # | 
| 4 |  | -# In production, this needs to be in separate files, e.g. service account and | 
| 5 |  | -# role and role binding needs to be created once, while stateful set may | 
| 6 |  | -# require some tuning. | 
| 7 |  | -# | 
| 8 |  | -# In addition, hostpath CSI driver is hardcoded as the CSI driver. | 
| 9 |  | -apiVersion: v1 | 
| 10 |  | -kind: ServiceAccount | 
| 11 |  | -metadata: | 
| 12 |  | -  name: csi-snapshotter | 
| 13 |  | -  | 
|  | 5 | +# Because external-snapshotter and external-provisioner get | 
|  | 6 | +# deployed in the same pod, we have to merge the permissions | 
|  | 7 | +# for the provisioner into the service account. This is not | 
|  | 8 | +# necessary when deploying separately. | 
|  | 9 | + | 
| 14 | 10 | --- | 
| 15 |  | -kind: ClusterRole | 
|  | 11 | +kind: ClusterRoleBinding | 
| 16 | 12 | apiVersion: rbac.authorization.k8s.io/v1 | 
| 17 | 13 | metadata: | 
| 18 |  | -  name: external-snapshotter-runner | 
| 19 |  | -rules: | 
| 20 |  | -  - apiGroups: [""] | 
| 21 |  | -    resources: ["persistentvolumes"] | 
| 22 |  | -    verbs: ["get", "list", "watch", "create", "delete"] | 
| 23 |  | -  - apiGroups: [""] | 
| 24 |  | -    resources: ["persistentvolumeclaims"] | 
| 25 |  | -    verbs: ["get", "list", "watch", "update"] | 
| 26 |  | -  - apiGroups: ["storage.k8s.io"] | 
| 27 |  | -    resources: ["storageclasses"] | 
| 28 |  | -    verbs: ["get", "list", "watch"] | 
| 29 |  | -  - apiGroups: [""] | 
| 30 |  | -    resources: ["events"] | 
| 31 |  | -    verbs: ["list", "watch", "create", "update", "patch"] | 
| 32 |  | -  - apiGroups: [""] | 
| 33 |  | -    resources: ["endpoints"] | 
| 34 |  | -    verbs: ["list", "watch", "create", "update", "delete", "get"] | 
| 35 |  | -  - apiGroups: [""] | 
| 36 |  | -    resources: ["secrets"] | 
| 37 |  | -    verbs: ["get", "list"] | 
| 38 |  | -  - apiGroups: ["snapshot.storage.k8s.io"] | 
| 39 |  | -    resources: ["volumesnapshotclasses"] | 
| 40 |  | -    verbs: ["get", "list", "watch"] | 
| 41 |  | -  - apiGroups: ["snapshot.storage.k8s.io"] | 
| 42 |  | -    resources: ["volumesnapshotcontents"] | 
| 43 |  | -    verbs: ["create", "get", "list", "watch", "update", "delete"] | 
| 44 |  | -  - apiGroups: ["snapshot.storage.k8s.io"] | 
| 45 |  | -    resources: ["volumesnapshots"] | 
| 46 |  | -    verbs: ["get", "list", "watch", "update"] | 
| 47 |  | -  - apiGroups: ["apiextensions.k8s.io"] | 
| 48 |  | -    resources: ["customresourcedefinitions"] | 
| 49 |  | -    verbs: ["create", "list", "watch", "delete"] | 
| 50 |  | -  | 
|  | 14 | +  name: csi-snapshotter-provisioner-role | 
|  | 15 | +subjects: | 
|  | 16 | +  - kind: ServiceAccount | 
|  | 17 | +    name: csi-snapshotter # from rbac.yaml | 
|  | 18 | +    # replace with non-default namespace name | 
|  | 19 | +    namespace: default | 
|  | 20 | +roleRef: | 
|  | 21 | +  kind: ClusterRole | 
|  | 22 | +  name: external-provisioner-runner # from rbac-external-provisioner.yaml | 
|  | 23 | +  apiGroup: rbac.authorization.k8s.io | 
|  | 24 | + | 
| 51 | 25 | --- | 
| 52 |  | -kind: ClusterRoleBinding | 
|  | 26 | +kind: RoleBinding | 
| 53 | 27 | apiVersion: rbac.authorization.k8s.io/v1 | 
| 54 | 28 | metadata: | 
| 55 |  | -  name: csi-snapshotter-role | 
|  | 29 | +  name: csi-snapshotter-provisioner-role-cfg | 
|  | 30 | +  # replace with non-default namespace name | 
|  | 31 | +  namespace: default | 
| 56 | 32 | subjects: | 
| 57 | 33 |   - kind: ServiceAccount | 
| 58 |  | -    name: csi-snapshotter | 
|  | 34 | +    name: csi-snapshotter # from rbac.yaml | 
|  | 35 | +    # replace with non-default namespace name | 
| 59 | 36 |     namespace: default | 
| 60 | 37 | roleRef: | 
| 61 |  | -  kind: ClusterRole | 
| 62 |  | -  name: external-snapshotter-runner | 
|  | 38 | +  kind: Role | 
|  | 39 | +  name: external-provisioner-cfg # from rbac-external-provisioner.yaml | 
| 63 | 40 |   apiGroup: rbac.authorization.k8s.io | 
| 64 |  | -  | 
|  | 41 | + | 
| 65 | 42 | --- | 
| 66 | 43 | kind: Service | 
| 67 | 44 | apiVersion: v1 | 
|  | 
0 commit comments