Skip to content

Commit f1a670b

Browse files
feat(plugin-barman-cloud): add user facing roles view and edit
1 parent 2f880f1 commit f1a670b

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

charts/plugin-barman-cloud/templates/rbac.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,52 @@ subjects:
114114
- kind: ServiceAccount
115115
name: {{ include "plugin-barman-cloud.serviceAccountName" . }}
116116
namespace: {{ include "plugin-barman-cloud.namespace" . }}
117+
---
118+
apiVersion: rbac.authorization.k8s.io/v1
119+
kind: ClusterRole
120+
metadata:
121+
labels:
122+
{{- include "plugin-barman-cloud.labels" . | nindent 4 }}
123+
{{- if .Values.rbac.aggregateClusterRoles }}
124+
rbac.authorization.k8s.io/aggregate-to-view: "true"
125+
rbac.authorization.k8s.io/aggregate-to-edit: "true"
126+
rbac.authorization.k8s.io/aggregate-to-admin: "true"
127+
{{- end }}
128+
name: {{ include "plugin-barman-cloud.fullname" . }}-viewer
129+
rules:
130+
- apiGroups:
131+
- barmancloud.cnpg.io
132+
resources:
133+
- objectstores
134+
verbs:
135+
- get
136+
- list
137+
- watch
138+
- apiGroups:
139+
- barmancloud.cnpg.io
140+
resources:
141+
- objectstores/status
142+
verbs:
143+
- get
144+
---
145+
apiVersion: rbac.authorization.k8s.io/v1
146+
kind: ClusterRole
147+
metadata:
148+
labels:
149+
{{- include "plugin-barman-cloud.labels" . | nindent 4 }}
150+
{{- if .Values.rbac.aggregateClusterRoles }}
151+
rbac.authorization.k8s.io/aggregate-to-edit: "true"
152+
rbac.authorization.k8s.io/aggregate-to-admin: "true"
153+
{{- end }}
154+
name: {{ include "plugin-barman-cloud.fullname" . }}-editor
155+
rules:
156+
- apiGroups:
157+
- barmancloud.cnpg.io
158+
resources:
159+
- objectstores
160+
verbs:
161+
- create
162+
- delete
163+
- patch
164+
- update
117165
{{- end }}

charts/plugin-barman-cloud/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@
318318
"required": [],
319319
"title": "create",
320320
"type": "boolean"
321+
},
322+
"aggregateClusterRoles": {
323+
"default": false,
324+
"description": "Specifies whether ClusterRoles should be aggregated to standard user roles",
325+
"required": [],
326+
"type": "boolean"
321327
}
322328
},
323329
"required": [

charts/plugin-barman-cloud/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ serviceAccount:
9292
rbac:
9393
# -- Specifies whether Role and RoleBinding should be created.
9494
create: true
95+
# -- Aggregate ClusterRoles to Kubernetes default user-facing roles.
96+
# Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles
97+
aggregateClusterRoles: false
9598

9699
# @schema
97100
# additionalProperties: true

0 commit comments

Comments
 (0)