Skip to content

Commit a04af32

Browse files
committed
split keycloak-sync RBAC into its own file
ServiceAccount/Role/RoleBinding were bundled into keycloak-sync-cronjob.yaml alongside the ConfigMap+CronJob, which is odd for a file named "cronjob". Moved RBAC out to keycloak-sync-rbac.yaml, no logic change. Signed-off-by: Rishi <rishi@obmondo.com>
1 parent 4e515f9 commit a04af32

2 files changed

Lines changed: 45 additions & 43 deletions

File tree

argocd-helm-charts/open-xchange/templates/keycloak-sync-cronjob.yaml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,49 +29,6 @@
2929
*/}}
3030
{{- if .Values.appsuite.keycloakSync.enabled }}
3131
{{- $sync := .Values.appsuite.keycloakSync }}
32-
# ServiceAccount the CronJob runs as. Only needed for the mail-backend side
33-
# (kubectl exec into the mail pod for mailbox provisioning) — OX user
34-
# provisioning itself goes over OX's own SOAP admin API now, not kubectl exec,
35-
# so no RBAC is needed against the OX namespace at all.
36-
apiVersion: v1
37-
kind: ServiceAccount
38-
metadata:
39-
name: {{ .Release.Name }}-keycloak-sync
40-
namespace: {{ .Release.Namespace }}
41-
{{- if $sync.mailProvisioning.enabled }}
42-
---
43-
# Cross-namespace RBAC (a RoleBinding can reference a ServiceAccount from
44-
# elsewhere, it just can't be created in that other namespace by this
45-
# release). Lets the job exec into the mail pod to run `setup email add` —
46-
# there's no SOAP/REST equivalent for Dovecot mailbox creation.
47-
apiVersion: rbac.authorization.k8s.io/v1
48-
kind: Role
49-
metadata:
50-
name: {{ .Release.Name }}-keycloak-sync
51-
namespace: {{ required "appsuite.keycloakSync.mailProvisioning.namespace is required when mailProvisioning is enabled" $sync.mailProvisioning.namespace }}
52-
rules:
53-
- apiGroups: [""]
54-
resources: ["pods"]
55-
verbs: ["list", "get"]
56-
- apiGroups: [""]
57-
resources: ["pods/exec"]
58-
verbs: ["create"]
59-
---
60-
apiVersion: rbac.authorization.k8s.io/v1
61-
kind: RoleBinding
62-
metadata:
63-
name: {{ .Release.Name }}-keycloak-sync
64-
namespace: {{ $sync.mailProvisioning.namespace }}
65-
roleRef:
66-
apiGroup: rbac.authorization.k8s.io
67-
kind: Role
68-
name: {{ .Release.Name }}-keycloak-sync
69-
subjects:
70-
- kind: ServiceAccount
71-
name: {{ .Release.Name }}-keycloak-sync
72-
namespace: {{ .Release.Namespace }}
73-
{{- end }}
74-
---
7532
apiVersion: v1
7633
kind: ConfigMap
7734
metadata:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{- if .Values.appsuite.keycloakSync.enabled }}
2+
{{- $sync := .Values.appsuite.keycloakSync }}
3+
# ServiceAccount the CronJob runs as. Only needed for the mail-backend side
4+
# (kubectl exec into the mail pod for mailbox provisioning) — OX user
5+
# provisioning itself goes over OX's own SOAP admin API now, not kubectl exec,
6+
# so no RBAC is needed against the OX namespace at all.
7+
apiVersion: v1
8+
kind: ServiceAccount
9+
metadata:
10+
name: {{ .Release.Name }}-keycloak-sync
11+
namespace: {{ .Release.Namespace }}
12+
{{- if $sync.mailProvisioning.enabled }}
13+
---
14+
# Cross-namespace RBAC (a RoleBinding can reference a ServiceAccount from
15+
# elsewhere, it just can't be created in that other namespace by this
16+
# release). Lets the job exec into the mail pod to run `setup email add` —
17+
# there's no SOAP/REST equivalent for Dovecot mailbox creation.
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: Role
20+
metadata:
21+
name: {{ .Release.Name }}-keycloak-sync
22+
namespace: {{ required "appsuite.keycloakSync.mailProvisioning.namespace is required when mailProvisioning is enabled" $sync.mailProvisioning.namespace }}
23+
rules:
24+
- apiGroups: [""]
25+
resources: ["pods"]
26+
verbs: ["list", "get"]
27+
- apiGroups: [""]
28+
resources: ["pods/exec"]
29+
verbs: ["create"]
30+
---
31+
apiVersion: rbac.authorization.k8s.io/v1
32+
kind: RoleBinding
33+
metadata:
34+
name: {{ .Release.Name }}-keycloak-sync
35+
namespace: {{ $sync.mailProvisioning.namespace }}
36+
roleRef:
37+
apiGroup: rbac.authorization.k8s.io
38+
kind: Role
39+
name: {{ .Release.Name }}-keycloak-sync
40+
subjects:
41+
- kind: ServiceAccount
42+
name: {{ .Release.Name }}-keycloak-sync
43+
namespace: {{ .Release.Namespace }}
44+
{{- end }}
45+
{{- end }}

0 commit comments

Comments
 (0)