webapi-admin-cluster-role.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. {{- if .Values.deploy.restapi }}
  2. {{- $allowedNamespaces := regexSplit " " (include "allowedNamespaces" .) -1 }}
  3. {{- range $index, $namespace := $allowedNamespaces }}
  4. {{- if and (eq $index 0) (not $.Values.disableClusterRole) }}
  5. ---
  6. apiVersion: rbac.authorization.k8s.io/v1
  7. kind: ClusterRole
  8. metadata:
  9. labels:
  10. api.stackgres.io/auth: user
  11. name: stackgres-restapi-admin
  12. {{- with $.Values.clusterOwnerRefereces }}
  13. ownerReferences:
  14. {{- toYaml . | nindent 4 }}
  15. {{- end }}
  16. rules:
  17. - apiGroups: ["rbac.authorization.k8s.io"]
  18. resources:
  19. - clusterroles
  20. - clusterrolebindings
  21. verbs:
  22. - get
  23. - list
  24. - watch
  25. - create
  26. - update
  27. - patch
  28. - delete
  29. - apiGroups: ["apiextensions.k8s.io"]
  30. resources:
  31. - customresourcedefinitions
  32. resourceNames:
  33. - sgconfigs.stackgres.io
  34. - sgclusters.stackgres.io
  35. - sginstanceprofiles.stackgres.io
  36. - sgpgconfigs.stackgres.io
  37. - sgpoolconfigs.stackgres.io
  38. - sgbackups.stackgres.io
  39. - sgbackupconfigs.stackgres.io
  40. - sgobjectstorages.stackgres.io
  41. - sgdbops.stackgres.io
  42. - sgdistributedlogs.stackgres.io
  43. - sgshardedclusters.stackgres.io
  44. - sgscripts.stackgres.io
  45. - sgstreams.stackgres.io
  46. verbs:
  47. - get
  48. - apiGroups: ["apiextensions.k8s.io"]
  49. resources:
  50. - customresourcedefinitions
  51. verbs:
  52. - list
  53. - apiGroups: ["", "storage.k8s.io"]
  54. resources:
  55. - namespaces
  56. - storageclasses
  57. verbs:
  58. - get
  59. - list
  60. - watch
  61. {{- end }}
  62. {{- if not (eq $namespace "_all_namespaces_placeholder") }}
  63. ---
  64. apiVersion: rbac.authorization.k8s.io/v1
  65. kind: Role
  66. metadata:
  67. namespace: {{ $namespace }}
  68. name: stackgres-restapi-admin
  69. rules:
  70. {{- end }}
  71. - apiGroups: ["", "batch"]
  72. resources:
  73. - pods/exec
  74. - configmaps
  75. - secrets
  76. - jobs
  77. verbs:
  78. - create
  79. - apiGroups: [""]
  80. resources:
  81. - pods/exec
  82. verbs:
  83. - get
  84. - apiGroups: ["", "batch"]
  85. resources:
  86. - configmaps
  87. - secrets
  88. - jobs
  89. verbs:
  90. - delete
  91. - apiGroups: [""]
  92. resources:
  93. - configmaps
  94. - secrets
  95. verbs:
  96. - patch
  97. - update
  98. - apiGroups: ["", "batch", "storage.k8s.io"]
  99. resources:
  100. - pods
  101. - services
  102. - configmaps
  103. - secrets
  104. - persistentvolumes
  105. - persistentvolumeclaims
  106. - events
  107. - jobs
  108. verbs:
  109. - get
  110. - list
  111. - watch
  112. - apiGroups: ["stackgres.io"]
  113. resources:
  114. - sgclusters
  115. - sgpgconfigs
  116. - sginstanceprofiles
  117. - sgpoolconfigs
  118. - sgbackupconfigs
  119. - sgbackups
  120. - sgdistributedlogs
  121. - sgdbops
  122. - sgobjectstorages
  123. - sgscripts
  124. - sgshardedclusters
  125. - sgshardedbackups
  126. - sgshardeddbops
  127. - sgstreams
  128. verbs:
  129. - create
  130. - watch
  131. - list
  132. - get
  133. - update
  134. - patch
  135. - delete
  136. - apiGroups: ["stackgres.io"]
  137. resources:
  138. - sgconfigs
  139. verbs:
  140. - watch
  141. - list
  142. - get
  143. - update
  144. - patch
  145. - apiGroups: ["rbac.authorization.k8s.io"]
  146. resources:
  147. - roles
  148. - rolebindings
  149. verbs:
  150. - get
  151. - list
  152. - watch
  153. - create
  154. - update
  155. - patch
  156. - delete
  157. {{- end }}
  158. {{- end }}