rbac.yaml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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: [""]
  38. resources: ["events"]
  39. verbs: ["list", "watch", "create", "update", "patch"]
  40. ---
  41. kind: ClusterRoleBinding
  42. apiVersion: rbac.authorization.k8s.io/v1
  43. metadata:
  44. name: csi-resizer-role
  45. subjects:
  46. - kind: ServiceAccount
  47. name: csi-resizer
  48. # replace with non-default namespace name
  49. namespace: default
  50. roleRef:
  51. kind: ClusterRole
  52. name: external-resizer-runner
  53. apiGroup: rbac.authorization.k8s.io
  54. ---
  55. # Resizer must be able to work with end point in current namespace
  56. # if (and only if) leadership election is enabled
  57. kind: Role
  58. apiVersion: rbac.authorization.k8s.io/v1
  59. metadata:
  60. # replace with non-default namespace name
  61. namespace: default
  62. name: external-resizer-cfg
  63. rules:
  64. - apiGroups: ["coordination.k8s.io"]
  65. resources: ["leases"]
  66. verbs: ["get", "watch", "list", "delete", "update", "create"]
  67. ---
  68. kind: RoleBinding
  69. apiVersion: rbac.authorization.k8s.io/v1
  70. metadata:
  71. name: csi-resizer-role-cfg
  72. # replace with non-default namespace name
  73. namespace: default
  74. subjects:
  75. - kind: ServiceAccount
  76. name: csi-resizer
  77. # replace with non-default namespace name
  78. namespace: default
  79. roleRef:
  80. kind: Role
  81. name: external-resizer-cfg
  82. apiGroup: rbac.authorization.k8s.io