webapi-reader-cluster-role.yaml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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-reader
  12. {{- with $.Values.clusterOwnerRefereces }}
  13. ownerReferences:
  14. {{- toYaml . | nindent 4 }}
  15. {{- end }}
  16. rules:
  17. - apiGroups: ["apiextensions.k8s.io"]
  18. resources:
  19. - customresourcedefinitions
  20. resourceNames:
  21. - sgconfigs.stackgres.io
  22. - sgclusters.stackgres.io
  23. - sginstanceprofiles.stackgres.io
  24. - sgpgconfigs.stackgres.io
  25. - sgpoolconfigs.stackgres.io
  26. - sgbackups.stackgres.io
  27. - sgbackupconfigs.stackgres.io
  28. - sgobjectstorages.stackgres.io
  29. - sgdbops.stackgres.io
  30. - sgdistributedlogs.stackgres.io
  31. - sgshardedclusters.stackgres.io
  32. - sgscripts.stackgres.io
  33. - sgstreams.stackgres.io
  34. verbs:
  35. - get
  36. - apiGroups: ["apiextensions.k8s.io"]
  37. resources:
  38. - customresourcedefinitions
  39. verbs:
  40. - list
  41. - apiGroups: ["", "storage.k8s.io"]
  42. resources:
  43. - namespaces
  44. - storageclasses
  45. verbs:
  46. - get
  47. - list
  48. - watch
  49. {{- end }}
  50. {{- if not (eq $namespace "_all_namespaces_placeholder") }}
  51. ---
  52. apiVersion: rbac.authorization.k8s.io/v1
  53. kind: Role
  54. metadata:
  55. namespace: {{ $namespace }}
  56. name: stackgres-restapi-reader
  57. rules:
  58. {{- end }}
  59. - apiGroups: ["", "batch"]
  60. resources:
  61. - pods/exec
  62. verbs:
  63. - create
  64. - apiGroups: [""]
  65. resources:
  66. - pods/exec
  67. verbs:
  68. - get
  69. - apiGroups: ["", "batch", "storage.k8s.io"]
  70. resources:
  71. - pods
  72. - services
  73. - configmaps
  74. - secrets
  75. - persistentvolumes
  76. - persistentvolumeclaims
  77. - events
  78. - jobs
  79. verbs:
  80. - get
  81. - list
  82. - watch
  83. - apiGroups: ["stackgres.io"]
  84. resources:
  85. - sgclusters
  86. - sgpgconfigs
  87. - sginstanceprofiles
  88. - sgpoolconfigs
  89. - sgbackupconfigs
  90. - sgbackups
  91. - sgdistributedlogs
  92. - sgdbops
  93. - sgobjectstorages
  94. - sgscripts
  95. - sgshardedclusters
  96. - sgshardedbackups
  97. - sgshardeddbops
  98. - sgstreams
  99. verbs:
  100. - watch
  101. - list
  102. - get
  103. - apiGroups: ["stackgres.io"]
  104. resources:
  105. - sgconfigs
  106. verbs:
  107. - watch
  108. - list
  109. - get
  110. {{- end }}
  111. {{- end }}