rbac.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Together with the RBAC file for external-provisioner, this YAML file
  2. # contains all RBAC objects that are necessary to run external CSI
  3. # snapshotter.
  4. #
  5. # In production, each CSI driver deployment has to be customized:
  6. # - to avoid conflicts, use non-default namespace and different names
  7. # for non-namespaced entities like the ClusterRole
  8. # - optionally rename the non-namespaced ClusterRole if there
  9. # are conflicts with other deployments
  10. apiVersion: v1
  11. kind: ServiceAccount
  12. metadata:
  13. name: csi-snapshotter
  14. ---
  15. kind: ClusterRole
  16. apiVersion: rbac.authorization.k8s.io/v1
  17. metadata:
  18. # rename if there are conflicts
  19. name: external-snapshotter-runner
  20. rules:
  21. - apiGroups: [""]
  22. resources: ["events"]
  23. verbs: ["list", "watch", "create", "update", "patch"]
  24. - apiGroups: [""]
  25. resources: ["secrets"]
  26. verbs: ["get", "list"]
  27. - apiGroups: ["snapshot.storage.k8s.io"]
  28. resources: ["volumesnapshotclasses"]
  29. verbs: ["get", "list", "watch"]
  30. - apiGroups: ["snapshot.storage.k8s.io"]
  31. resources: ["volumesnapshotcontents"]
  32. verbs: ["create", "get", "list", "watch", "update", "delete"]
  33. - apiGroups: ["snapshot.storage.k8s.io"]
  34. resources: ["volumesnapshotcontents/status"]
  35. verbs: ["update"]
  36. ---
  37. kind: ClusterRoleBinding
  38. apiVersion: rbac.authorization.k8s.io/v1
  39. metadata:
  40. name: csi-snapshotter-role
  41. subjects:
  42. - kind: ServiceAccount
  43. name: csi-snapshotter
  44. # replace with non-default namespace name
  45. namespace: default
  46. roleRef:
  47. kind: ClusterRole
  48. # change the name also here if the ClusterRole gets renamed
  49. name: external-snapshotter-runner
  50. apiGroup: rbac.authorization.k8s.io
  51. ---
  52. kind: Role
  53. apiVersion: rbac.authorization.k8s.io/v1
  54. metadata:
  55. namespace: default # TODO: replace with the namespace you want for your sidecar
  56. name: external-snapshotter-leaderelection
  57. rules:
  58. - apiGroups: ["coordination.k8s.io"]
  59. resources: ["leases"]
  60. verbs: ["get", "watch", "list", "delete", "update", "create"]
  61. ---
  62. kind: RoleBinding
  63. apiVersion: rbac.authorization.k8s.io/v1
  64. metadata:
  65. name: external-snapshotter-leaderelection
  66. namespace: default # TODO: replace with the namespace you want for your sidecar
  67. subjects:
  68. - kind: ServiceAccount
  69. name: csi-snapshotter
  70. namespace: default # TODO: replace with the namespace you want for your sidecar
  71. roleRef:
  72. kind: Role
  73. name: external-snapshotter-leaderelection
  74. apiGroup: rbac.authorization.k8s.io