|
| 1 | +--- |
| 2 | +# Source: postgres-operator/templates/clusterrole.yaml |
| 3 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 4 | +kind: ClusterRole |
| 5 | +metadata: |
| 6 | + name: postgres-operator |
| 7 | + labels: |
| 8 | + app.kubernetes.io/name: postgres-operator |
| 9 | + helm.sh/chart: postgres-operator-1.14.0 |
| 10 | + app.kubernetes.io/managed-by: Helm |
| 11 | + app.kubernetes.io/instance: postgres-operator |
| 12 | +rules: |
| 13 | +# all verbs allowed for custom operator resources |
| 14 | +- apiGroups: |
| 15 | + - acid.zalan.do |
| 16 | + resources: |
| 17 | + - postgresqls |
| 18 | + - postgresqls/status |
| 19 | + - operatorconfigurations |
| 20 | + verbs: |
| 21 | + - create |
| 22 | + - delete |
| 23 | + - deletecollection |
| 24 | + - get |
| 25 | + - list |
| 26 | + - patch |
| 27 | + - update |
| 28 | + - watch |
| 29 | +# operator only reads PostgresTeams |
| 30 | +- apiGroups: |
| 31 | + - acid.zalan.do |
| 32 | + resources: |
| 33 | + - postgresteams |
| 34 | + verbs: |
| 35 | + - get |
| 36 | + - list |
| 37 | + - watch |
| 38 | +# all verbs allowed for event streams |
| 39 | +# to create or get/update CRDs when starting up |
| 40 | +- apiGroups: |
| 41 | + - apiextensions.k8s.io |
| 42 | + resources: |
| 43 | + - customresourcedefinitions |
| 44 | + verbs: |
| 45 | + - get |
| 46 | + - create |
| 47 | + - patch |
| 48 | + - update |
| 49 | +# to send events to the CRs |
| 50 | +- apiGroups: |
| 51 | + - "" |
| 52 | + resources: |
| 53 | + - events |
| 54 | + verbs: |
| 55 | + - create |
| 56 | + - get |
| 57 | + - list |
| 58 | + - patch |
| 59 | + - update |
| 60 | + - watch |
| 61 | +# to manage endpoints/configmaps which are also used by Patroni |
| 62 | +# to read configuration from ConfigMaps |
| 63 | +- apiGroups: |
| 64 | + - "" |
| 65 | + resources: |
| 66 | + - configmaps |
| 67 | + verbs: |
| 68 | + - get |
| 69 | +- apiGroups: |
| 70 | + - "" |
| 71 | + resources: |
| 72 | + - endpoints |
| 73 | + verbs: |
| 74 | + - create |
| 75 | + - delete |
| 76 | + - deletecollection |
| 77 | + - get |
| 78 | + - list |
| 79 | + - patch |
| 80 | + - update |
| 81 | + - watch |
| 82 | +# to CRUD secrets for database access |
| 83 | +- apiGroups: |
| 84 | + - "" |
| 85 | + resources: |
| 86 | + - secrets |
| 87 | + verbs: |
| 88 | + - create |
| 89 | + - delete |
| 90 | + - get |
| 91 | + - patch |
| 92 | + - update |
| 93 | +# to check nodes for node readiness label |
| 94 | +- apiGroups: |
| 95 | + - "" |
| 96 | + resources: |
| 97 | + - nodes |
| 98 | + verbs: |
| 99 | + - get |
| 100 | + - list |
| 101 | + - watch |
| 102 | +# to read or delete existing PVCs. Creation via StatefulSet |
| 103 | +- apiGroups: |
| 104 | + - "" |
| 105 | + resources: |
| 106 | + - persistentvolumeclaims |
| 107 | + verbs: |
| 108 | + - delete |
| 109 | + - get |
| 110 | + - list |
| 111 | + - patch |
| 112 | + - update |
| 113 | + # to read existing PVs. Creation should be done via dynamic provisioning |
| 114 | +- apiGroups: |
| 115 | + - "" |
| 116 | + resources: |
| 117 | + - persistentvolumes |
| 118 | + verbs: |
| 119 | + - get |
| 120 | + - list |
| 121 | +# to watch Spilo pods and do rolling updates. Creation via StatefulSet |
| 122 | +- apiGroups: |
| 123 | + - "" |
| 124 | + resources: |
| 125 | + - pods |
| 126 | + verbs: |
| 127 | + - delete |
| 128 | + - get |
| 129 | + - list |
| 130 | + - patch |
| 131 | + - update |
| 132 | + - watch |
| 133 | +# to resize the filesystem in Spilo pods when increasing volume size |
| 134 | +- apiGroups: |
| 135 | + - "" |
| 136 | + resources: |
| 137 | + - pods/exec |
| 138 | + verbs: |
| 139 | + - create |
| 140 | +# to CRUD services to point to Postgres cluster instances |
| 141 | +- apiGroups: |
| 142 | + - "" |
| 143 | + resources: |
| 144 | + - services |
| 145 | + verbs: |
| 146 | + - create |
| 147 | + - delete |
| 148 | + - get |
| 149 | + - patch |
| 150 | + - update |
| 151 | +# to CRUD the StatefulSet which controls the Postgres cluster instances |
| 152 | +- apiGroups: |
| 153 | + - apps |
| 154 | + resources: |
| 155 | + - statefulsets |
| 156 | + - deployments |
| 157 | + verbs: |
| 158 | + - create |
| 159 | + - delete |
| 160 | + - get |
| 161 | + - list |
| 162 | + - patch |
| 163 | + - update |
| 164 | +# to CRUD cron jobs for logical backups |
| 165 | +- apiGroups: |
| 166 | + - batch |
| 167 | + resources: |
| 168 | + - cronjobs |
| 169 | + verbs: |
| 170 | + - create |
| 171 | + - delete |
| 172 | + - get |
| 173 | + - list |
| 174 | + - patch |
| 175 | + - update |
| 176 | +# to get namespaces operator resources can run in |
| 177 | +- apiGroups: |
| 178 | + - "" |
| 179 | + resources: |
| 180 | + - namespaces |
| 181 | + verbs: |
| 182 | + - get |
| 183 | +# to define PDBs. Update happens via delete/create |
| 184 | +- apiGroups: |
| 185 | + - policy |
| 186 | + resources: |
| 187 | + - poddisruptionbudgets |
| 188 | + verbs: |
| 189 | + - create |
| 190 | + - delete |
| 191 | + - get |
| 192 | +# to create ServiceAccounts in each namespace the operator watches |
| 193 | +- apiGroups: |
| 194 | + - "" |
| 195 | + resources: |
| 196 | + - serviceaccounts |
| 197 | + verbs: |
| 198 | + - get |
| 199 | + - create |
| 200 | +# to create role bindings to the postgres-pod service account |
| 201 | +- apiGroups: |
| 202 | + - rbac.authorization.k8s.io |
| 203 | + resources: |
| 204 | + - rolebindings |
| 205 | + verbs: |
| 206 | + - get |
| 207 | + - create |
0 commit comments