Skip to content

Commit a6d4f23

Browse files
WikiwixPhilip Sieder
and
Philip Sieder
authored
Add user facing ClusterRoles to Helm chart (zalando#1675)
To allow the usage of the [aggregate ClusterRoles] (https://github.com/zalando/postgres-operator/blob/master/manifests/user-facing-clusterroles.yaml), an option in the Helm chart is added. Fixes zalando#1668 Co-authored-by: Philip Sieder <philip.sieder@tallence.com>
1 parent 0b00372 commit a6d4f23

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{{ if .Values.rbac.createAggregateClusterRoles }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels:
6+
rbac.authorization.k8s.io/aggregate-to-admin: "true"
7+
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
8+
helm.sh/chart: {{ template "postgres-operator.chart" . }}
9+
app.kubernetes.io/managed-by: {{ .Release.Service }}
10+
app.kubernetes.io/instance: {{ .Release.Name }}
11+
name: {{ template "postgres-operator.fullname" . }}:users:admin
12+
rules:
13+
- apiGroups:
14+
- acid.zalan.do
15+
resources:
16+
- postgresqls
17+
- postgresqls/status
18+
verbs:
19+
- create
20+
- delete
21+
- deletecollection
22+
- get
23+
- list
24+
- patch
25+
- update
26+
- watch
27+
28+
---
29+
apiVersion: rbac.authorization.k8s.io/v1
30+
kind: ClusterRole
31+
metadata:
32+
labels:
33+
rbac.authorization.k8s.io/aggregate-to-edit: "true"
34+
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
35+
helm.sh/chart: {{ template "postgres-operator.chart" . }}
36+
app.kubernetes.io/managed-by: {{ .Release.Service }}
37+
app.kubernetes.io/instance: {{ .Release.Name }}
38+
name: {{ template "postgres-operator.fullname" . }}:users:edit
39+
rules:
40+
- apiGroups:
41+
- acid.zalan.do
42+
resources:
43+
- postgresqls
44+
verbs:
45+
- create
46+
- update
47+
- patch
48+
- delete
49+
50+
---
51+
apiVersion: rbac.authorization.k8s.io/v1
52+
kind: ClusterRole
53+
metadata:
54+
labels:
55+
rbac.authorization.k8s.io/aggregate-to-view: "true"
56+
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
57+
helm.sh/chart: {{ template "postgres-operator.chart" . }}
58+
app.kubernetes.io/managed-by: {{ .Release.Service }}
59+
app.kubernetes.io/instance: {{ .Release.Name }}
60+
name: {{ template "postgres-operator.fullname" . }}:users:view
61+
rules:
62+
- apiGroups:
63+
- acid.zalan.do
64+
resources:
65+
- postgresqls
66+
- postgresqls/status
67+
verbs:
68+
- get
69+
- list
70+
- watch
71+
{{ end }}

charts/postgres-operator/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ configConnectionPooler:
361361
rbac:
362362
# Specifies whether RBAC resources should be created
363363
create: true
364+
# Specifies whether ClusterRoles that are aggregated into the K8s default roles should be created. (https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings)
365+
createAggregateClusterRoles: false
364366

365367
serviceAccount:
366368
# Specifies whether a ServiceAccount should be created

docs/administrator.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ kubectl create -f manifests/user-facing-clusterroles.yaml
291291
It creates zalando-postgres-operator:user:view, :edit and :admin clusterroles
292292
that are aggregated into the K8s [default roles](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings).
293293

294+
For Helm deployments setting `rbac.createAggregateClusterRoles: true` adds these clusterroles to the deployment.
295+
294296
## Use taints and tolerations for dedicated PostgreSQL nodes
295297

296298
To ensure Postgres pods are running on nodes without any other application pods,
@@ -762,7 +764,7 @@ WALE_S3_PREFIX=$WAL_S3_BUCKET/spilo/{WAL_BUCKET_SCOPE_PREFIX}{SCOPE}{WAL_BUCKET_
762764
```
763765

764766
The operator sets the prefix to an empty string so that spilo will generate it
765-
from the configured `WAL_S3_BUCKET`.
767+
from the configured `WAL_S3_BUCKET`.
766768

767769
:warning: When you overwrite the configuration by defining `WAL_S3_BUCKET` in
768770
the [pod_environment_configmap](#custom-pod-environment-variables) you have

0 commit comments

Comments
 (0)