rbac.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # This YAML file contains all RBAC objects that are necessary to run external
  2. # CSI attacher.
  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. # attacher, 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-attacher
  14. # replace with non-default namespace name
  15. namespace: default
  16. ---
  17. # Attacher must be able to work with PVs, nodes and VolumeAttachments
  18. kind: ClusterRole
  19. apiVersion: rbac.authorization.k8s.io/v1
  20. metadata:
  21. name: external-attacher-runner
  22. rules:
  23. - apiGroups: [""]
  24. resources: ["persistentvolumes"]
  25. verbs: ["get", "list", "watch", "update"]
  26. - apiGroups: [""]
  27. resources: ["nodes"]
  28. verbs: ["get", "list", "watch"]
  29. - apiGroups: ["csi.storage.k8s.io"]
  30. resources: ["csinodeinfos"]
  31. verbs: ["get", "list", "watch"]
  32. - apiGroups: ["storage.k8s.io"]
  33. resources: ["volumeattachments"]
  34. verbs: ["get", "list", "watch", "update"]
  35. ---
  36. kind: ClusterRoleBinding
  37. apiVersion: rbac.authorization.k8s.io/v1
  38. metadata:
  39. name: csi-attacher-role
  40. subjects:
  41. - kind: ServiceAccount
  42. name: csi-attacher
  43. # replace with non-default namespace name
  44. namespace: default
  45. roleRef:
  46. kind: ClusterRole
  47. name: external-attacher-runner
  48. apiGroup: rbac.authorization.k8s.io
  49. ---
  50. # Attacher must be able to work with config map in current namespace
  51. # if (and only if) leadership election is enabled
  52. kind: Role
  53. apiVersion: rbac.authorization.k8s.io/v1
  54. metadata:
  55. # replace with non-default namespace name
  56. namespace: default
  57. name: external-attacher-cfg
  58. rules:
  59. - apiGroups: [""]
  60. resources: ["configmaps"]
  61. verbs: ["get", "watch", "list", "delete", "update", "create"]
  62. ---
  63. kind: RoleBinding
  64. apiVersion: rbac.authorization.k8s.io/v1
  65. metadata:
  66. name: csi-attacher-role-cfg
  67. # replace with non-default namespace name
  68. namespace: default
  69. subjects:
  70. - kind: ServiceAccount
  71. name: csi-attacher
  72. # replace with non-default namespace name
  73. namespace: default
  74. roleRef:
  75. kind: Role
  76. name: external-attacher-cfg
  77. apiGroup: rbac.authorization.k8s.io