Skip to content

Commit

Permalink
Ensure postgresclusters are available to admin/edit/view clusterroles
Browse files Browse the repository at this point in the history
See https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
  • Loading branch information
sathieu committed Dec 1, 2021
1 parent 24f5849 commit bbafac2
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 0 deletions.
24 changes: 24 additions & 0 deletions helm/install/templates/clusterrole-aggregate-edit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.createAggregateRoles }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-aggregate-edit
labels:
{{- include "install.labels" . | nindent 4 }}
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- postgres-operator.crunchydata.com
resources:
- postgresclusters
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
{{- end }}
20 changes: 20 additions & 0 deletions helm/install/templates/clusterrole-aggregate-view.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.createAggregateRoles }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-aggregate-view
labels:
{{- include "install.labels" . | nindent 4 }}
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- postgres-operator.crunchydata.com
resources:
- postgresclusters
verbs:
- get
- list
- watch
{{- end }}
4 changes: 4 additions & 0 deletions helm/install/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ singleNamespace: false
# debug allows you to enable or disable the "debug" level of logging.
# Defaults to the value below.
debug: true

# Create aggregated ClusterRoles
# See https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles
createAggregateRoles: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: postgres-operator-aggregate-edit
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- postgres-operator.crunchydata.com
resources:
- postgresclusters
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: postgres-operator-aggregate-view
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- postgres-operator.crunchydata.com
resources:
- postgresclusters
verbs:
- get
- list
- watch
2 changes: 2 additions & 0 deletions kustomize/install/bases/rbac/cluster/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ resources:
- service_account.yaml
- role.yaml
- role_binding.yaml
- clusterrole-aggregate-edit.yaml
- clusterrole-aggregate-view.yaml

0 comments on commit bbafac2

Please sign in to comment.