Skip to content

Commit

Permalink
fix: chart rbac (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis authored Dec 6, 2023
1 parent 48fa91f commit b7d2e9c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ spec:
serviceAccount: keycloakrealm-default
```

**Note**: The proxy needs read access to keycloakrealms as well as patch access to the /status subresource.
In the example above there is a ClusterRole called keycloakrealm-proxy granting just that. This ClusterRole also is bundled in the helm chart, you may use {releaseName}-proxy for the RoleBinding.

## Installation

### Helm
Expand Down
48 changes: 39 additions & 9 deletions chart/keycloak-controller/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{{- if .Values.clusterRBAC.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "keycloak-controller.fullname" . }}-proxy
rules:
- apiGroups: ["keycloak.infra.doodle.com"]
resources:
- keycloakrealms
verbs: ["get"]
- apiGroups: ["keycloak.infra.doodle.com"]
resources:
- keycloakrealms/status
verbs: ["get", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "keycloak-controller.fullname" . }}
labels:
Expand All @@ -11,14 +25,6 @@ metadata:
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- "keycloak.infra.doodle.com"
resources:
Expand Down Expand Up @@ -55,4 +61,28 @@ rules:
- patch
- update
- watch
{{- end }}
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
{{- end }}

0 comments on commit b7d2e9c

Please sign in to comment.