rbac.yaml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # This YAML file contains all RBAC objects that are necessary to run external
  2. # CSI resizer.
  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. # resizer, in which case leadership election must be enabled;
  9. # this influences the RBAC setup, see below
  10. apiVersion: v1
  11. kind: ServiceAccount
  12. metadata:
  13. name: csi-resizer
  14. # replace with non-default namespace name
  15. namespace: default
  16. ---
  17. # Resizer must be able to work with PVCs, PVs, SCs.
  18. kind: ClusterRole
  19. apiVersion: rbac.authorization.k8s.io/v1
  20. metadata:
  21. name: external-resizer-runner
  22. rules:
  23. # The following rule should be uncommented for plugins that require secrets
  24. # for provisioning.
  25. # - apiGroups: [""]
  26. # resources: ["secrets"]
  27. # verbs: ["get", "list", "watch"]
  28. - apiGroups: [""]
  29. resources: ["persistentvolumes"]
  30. verbs: ["get", "list", "watch", "update", "patch"]
  31. - apiGroups: [""]
  32. resources: ["persistentvolumeclaims"]
  33. verbs: ["get", "list", "watch"]
  34. - apiGroups: [""]
  35. resources: ["persistentvolumeclaims/status"]
  36. verbs: ["update", "patch"]
  37. - apiGroups: ["storage.k8s.io"]
  38. resources: ["storageclasses"]
  39. verbs: ["get", "list", "watch"]
  40. - apiGroups: [""]
  41. resources: ["events"]
  42. verbs: ["list", "watch", "create", "update", "patch"]
  43. ---
  44. kind: ClusterRoleBinding
  45. apiVersion: rbac.authorization.k8s.io/v1
  46. metadata:
  47. name: csi-resizer-role
  48. subjects:
  49. - kind: ServiceAccount
  50. name: csi-resizer
  51. # replace with non-default namespace name
  52. namespace: default
  53. roleRef:
  54. kind: ClusterRole
  55. name: external-resizer-runner
  56. apiGroup: rbac.authorization.k8s.io
  57. ---
  58. # Resizer must be able to work with leases in current namespace
  59. # if (and only if) leadership election is enabled
  60. kind: Role
  61. apiVersion: rbac.authorization.k8s.io/v1
  62. metadata:
  63. # replace with non-default namespace name
  64. namespace: default
  65. name: external-resizer-cfg
  66. rules:
  67. - apiGroups: ["coordination.k8s.io"]
  68. resources: ["leases"]
  69. verbs: ["get", "watch", "list", "delete", "update", "create"]
  70. ---
  71. kind: RoleBinding
  72. apiVersion: rbac.authorization.k8s.io/v1
  73. metadata:
  74. name: csi-resizer-role-cfg
  75. # replace with non-default namespace name
  76. namespace: default
  77. subjects:
  78. - kind: ServiceAccount
  79. name: csi-resizer
  80. # replace with non-default namespace name
  81. namespace: default
  82. roleRef:
  83. kind: Role
  84. name: external-resizer-cfg
  85. apiGroup: rbac.authorization.k8s.io