Skip to content

Commit f7ff0cf

Browse files
[keycloak] Import realm (CloudPirates-io#219)
* feat(keycloak): import realm * fix(keycloak): default values to avoid crash * chore(keycloak): update changelog * chore: bump chart version --------- Signed-off-by: Tanguy Falconnet <tanguy.falco@gmail.com>
1 parent af00fe0 commit f7ff0cf

File tree

7 files changed

+158
-6
lines changed

7 files changed

+158
-6
lines changed

charts/keycloak/CHANGELOG.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,88 @@
11
# Changelog
22

3+
## 0.4.0 (2025-10-10)
4+
5+
* [keycloak] Allow to import a realm at startup from a json config ([#219](https://github.com/CloudPirates-io/helm-charts/pull/219))
6+
37
## 0.3.2 (2025-10-09)
48

59
* [mongodb] fix: newline between mongo labels and additional labels ([#301](https://github.com/CloudPirates-io/helm-charts/pull/301))
10+
11+
## 0.3.1 (2025-10-09)
12+
13+
* [keycloak/keycloak] Update charts/keycloak/values.yaml keycloak/keycloak to v26.3.5 (patch) ([#261](https://github.com/CloudPirates-io/helm-charts/pull/261))
14+
15+
## 0.3.0 (2025-10-08)
16+
17+
* make keycloak run on openshift (#225) ([9b4f896](https://github.com/CloudPirates-io/helm-charts/commit/9b4f896)), closes [#225](https://github.com/CloudPirates-io/helm-charts/issues/225)
18+
19+
## <small>0.2.1 (2025-10-07)</small>
20+
21+
* default http relative path to '/' to fix argocd deployment (#221) ([bdb1946](https://github.com/CloudPirates-io/helm-charts/commit/bdb1946)), closes [#221](https://github.com/CloudPirates-io/helm-charts/issues/221)
22+
23+
## 0.2.0 (2025-10-06)
24+
25+
* Add support for extra volumes, volumeMounts and initContainers (#215) ([16afcfe](https://github.com/CloudPirates-io/helm-charts/commit/16afcfe)), closes [#215](https://github.com/CloudPirates-io/helm-charts/issues/215)
26+
27+
## <small>0.1.12 (2025-10-06)</small>
28+
29+
* [mariadb] chore(deps): update mariadb:12.0.2 Docker digest to 03a03a6 (#208) ([01a6ad1](https://github.com/CloudPirates-io/helm-charts/commit/01a6ad1)), closes [#208](https://github.com/CloudPirates-io/helm-charts/issues/208)
30+
* [mariadb] use tpl to return existingConfigMap (#217) ([c7c2f4c](https://github.com/CloudPirates-io/helm-charts/commit/c7c2f4c)), closes [#217](https://github.com/CloudPirates-io/helm-charts/issues/217)
31+
32+
## <small>0.1.11 (2025-10-06)</small>
33+
34+
* Allow keycloak to have a relative path (#216) ([0237457](https://github.com/CloudPirates-io/helm-charts/commit/0237457)), closes [#216](https://github.com/CloudPirates-io/helm-charts/issues/216)
35+
36+
## <small>0.1.10 (2025-10-02)</small>
37+
38+
* [postgres] chore(deps): update postgres:17.6 Docker digest to e6a4209 (#173) ([beb0b40](https://github.com/CloudPirates-io/helm-charts/commit/beb0b40)), closes [#173](https://github.com/CloudPirates-io/helm-charts/issues/173)
39+
40+
## <small>0.1.9 (2025-10-02)</small>
41+
42+
* add topologySpreadConstraints and trafficDistribution opti… (#209) ([c777fca](https://github.com/CloudPirates-io/helm-charts/commit/c777fca)), closes [#209](https://github.com/CloudPirates-io/helm-charts/issues/209)
43+
44+
## <small>0.1.8 (2025-09-30)</small>
45+
46+
* Feature/command customize (#186) ([a458e15](https://github.com/CloudPirates-io/helm-charts/commit/a458e15)), closes [#186](https://github.com/CloudPirates-io/helm-charts/issues/186)
47+
48+
## <small>0.1.7 (2025-09-29)</small>
49+
50+
* replace deprecated 'proxy' with new proxy parameters (#183) ([d850b7b](https://github.com/CloudPirates-io/helm-charts/commit/d850b7b)), closes [#183](https://github.com/CloudPirates-io/helm-charts/issues/183)
51+
52+
## <small>0.1.6 (2025-09-26)</small>
53+
54+
* [postgres] chore(deps): update postgres:17.6 Docker digest to 0b6428e (#162) ([6293612](https://github.com/CloudPirates-io/helm-charts/commit/6293612)), closes [#162](https://github.com/CloudPirates-io/helm-charts/issues/162)
55+
56+
## <small>0.1.5 (2025-09-25)</small>
57+
58+
* add namespaces to templates, change user/group-ids to 1001 ([31b203b](https://github.com/CloudPirates-io/helm-charts/commit/31b203b))
59+
* add readme documentation and values.schema.json ([369448b](https://github.com/CloudPirates-io/helm-charts/commit/369448b))
60+
* add support for extra env vars from an existing secret (#158) ([263604f](https://github.com/CloudPirates-io/helm-charts/commit/263604f)), closes [#158](https://github.com/CloudPirates-io/helm-charts/issues/158)
61+
* Fix resolving template expressions in extraobjects ([12a1cb5](https://github.com/CloudPirates-io/helm-charts/commit/12a1cb5))
62+
* [postgres] chore(deps): update postgres:17.6 Docker digest to 0f4f200 ([b4a6a30](https://github.com/CloudPirates-io/helm-charts/commit/b4a6a30))
63+
* Add keycloak logo ([bf1e1c2](https://github.com/CloudPirates-io/helm-charts/commit/bf1e1c2))
64+
* Add TODO ([8162d60](https://github.com/CloudPirates-io/helm-charts/commit/8162d60))
65+
* Artifact hub id ([02540ae](https://github.com/CloudPirates-io/helm-charts/commit/02540ae))
66+
* Bump the correct thing ([35e7901](https://github.com/CloudPirates-io/helm-charts/commit/35e7901))
67+
* Fix chart version bump ([aae07b1](https://github.com/CloudPirates-io/helm-charts/commit/aae07b1))
68+
* Fix deprecated env vars warning ([50d9fa0](https://github.com/CloudPirates-io/helm-charts/commit/50d9fa0))
69+
* Fix lint ([4bf9e77](https://github.com/CloudPirates-io/helm-charts/commit/4bf9e77))
70+
* Fix lint 2 ([a38fc35](https://github.com/CloudPirates-io/helm-charts/commit/a38fc35))
71+
* Fix lint 3 ([0875bfa](https://github.com/CloudPirates-io/helm-charts/commit/0875bfa))
72+
* Fix lint 4 ([7fcbd78](https://github.com/CloudPirates-io/helm-charts/commit/7fcbd78))
73+
* Improvements ([cea8f2c](https://github.com/CloudPirates-io/helm-charts/commit/cea8f2c))
74+
* Initial implementation ([c5d41ec](https://github.com/CloudPirates-io/helm-charts/commit/c5d41ec))
75+
* Rework keycloak ([2afb0fd](https://github.com/CloudPirates-io/helm-charts/commit/2afb0fd))
76+
* Update CHANGELOG.md ([b7572a8](https://github.com/CloudPirates-io/helm-charts/commit/b7572a8))
77+
* Update CHANGELOG.md ([245f9b6](https://github.com/CloudPirates-io/helm-charts/commit/245f9b6))
78+
* Update CHANGELOG.md ([0bf9f75](https://github.com/CloudPirates-io/helm-charts/commit/0bf9f75))
79+
* Update CHANGELOG.md ([03d476e](https://github.com/CloudPirates-io/helm-charts/commit/03d476e))
80+
* Update CHANGELOG.md ([20c19bb](https://github.com/CloudPirates-io/helm-charts/commit/20c19bb))
81+
* Update CHANGELOG.md ([68435aa](https://github.com/CloudPirates-io/helm-charts/commit/68435aa))
82+
* Update CHANGELOG.md ([b8adca8](https://github.com/CloudPirates-io/helm-charts/commit/b8adca8))
83+
* Update CHANGELOG.md ([62e51b9](https://github.com/CloudPirates-io/helm-charts/commit/62e51b9))
84+
* Update CHANGELOG.md ([54f725e](https://github.com/CloudPirates-io/helm-charts/commit/54f725e))
85+
* Update CHANGELOG.md ([2ed9b3f](https://github.com/CloudPirates-io/helm-charts/commit/2ed9b3f))
86+
* Update CHANGELOG.md ([2178148](https://github.com/CloudPirates-io/helm-charts/commit/2178148))
87+
* Update CHANGELOG.md ([8d6710f](https://github.com/CloudPirates-io/helm-charts/commit/8d6710f))
88+
* chore: fix changelog ([bd9f1a8](https://github.com/CloudPirates-io/helm-charts/commit/bd9f1a8))

charts/keycloak/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: keycloak
33
description: Open Source Identity and Access Management Solution
44
type: application
5-
version: 0.3.2
5+
version: 0.4.0
66
appVersion: "26.3.4"
77
keywords:
88
- keycloak

charts/keycloak/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ The following table lists the configurable parameters of the Keycloak chart and
167167
| `cache.stack` | Cache stack (local, ispn, default) | `local` |
168168
| `cache.configFile` | Custom cache configuration file | `""` |
169169

170+
### Realm Configuration
171+
172+
| Parameter | Description | Default |
173+
| ------------------ | -------------------------------------------------------------------------------------- | ------- |
174+
| `realm.import` | Enable import of realms from /opt/keycloak/data/import (production mode must be false) | `false` |
175+
| `realm.configFile` | Json config for initial realm configuration, mounted in /opt/keycloak/data/import | `""` |
176+
170177
### Features Configuration
171178

172179
| Parameter | Description | Default |
@@ -460,6 +467,19 @@ kubectl create secret generic keycloak-db-credentials \
460467
--from-literal=db-username=keycloak
461468
```
462469

470+
### Realm import
471+
472+
```yaml
473+
realm:
474+
import: true
475+
configFile: |
476+
{
477+
"realm": "my-realm",
478+
"enabled": true
479+
}
480+
```
481+
482+
463483
### High Availability Setup
464484

465485
```yaml

charts/keycloak/templates/configmap.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,21 @@ metadata:
1313
data:
1414
cache-ispn.xml: |
1515
{{- .Values.cache.configFile | nindent 4 }}
16-
{{- end }}
16+
{{- end }}
17+
{{- if .Values.realm.import }}
18+
---
19+
kind: ConfigMap
20+
apiVersion: v1
21+
metadata:
22+
name: {{ include "keycloak.fullname" . }}-realm
23+
namespace: {{ .Release.Namespace }}
24+
labels:
25+
{{- include "keycloak.labels" . | nindent 4 }}
26+
{{- with (include "keycloak.annotations" .) }}
27+
annotations:
28+
{{- . | nindent 4 }}
29+
{{- end }}
30+
data:
31+
realm.json: |
32+
{{ .Values.realm.configFile | nindent 4 }}
33+
{{- end }}

charts/keycloak/templates/deployment.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ spec:
6767
- start
6868
{{- else }}
6969
- start-dev
70+
{{- if .Values.realm.import }}
71+
- --import-realm
72+
{{- end }}
7073
{{- end }}
7174
{{- if .Values.keycloak.httpEnabled }}
7275
- --http-enabled=true
@@ -220,10 +223,14 @@ spec:
220223
mountPath: /opt/keycloak/work
221224
- name: keycloak-lib-quarkus
222225
mountPath: /opt/keycloak/lib/quarkus
226+
{{- if .Values.realm.import }}
227+
- name: realm-config
228+
mountPath: /opt/keycloak/data/import
229+
readOnly: true
230+
{{- end }}
223231
{{- if .Values.extraVolumeMounts }}
224232
{{- toYaml .Values.extraVolumeMounts | nindent 12}}
225233
{{- end }}
226-
227234
volumes:
228235
{{- if .Values.persistence.enabled }}
229236
- name: data
@@ -244,9 +251,14 @@ spec:
244251
emptyDir: {}
245252
- name: keycloak-lib-quarkus
246253
emptyDir: {}
247-
{{- if .Values.extraVolumes }}
248-
{{- toYaml .Values.extraVolumes | nindent 8 }}
249-
{{- end }}
254+
{{- if .Values.realm.import }}
255+
- name: realm-config
256+
configMap:
257+
name: {{ include "keycloak.fullname" . }}-realm
258+
{{- end }}
259+
{{- if .Values.extraVolumes }}
260+
{{- toYaml .Values.extraVolumes | nindent 8 }}
261+
{{- end }}
250262
{{- with .Values.nodeSelector }}
251263
nodeSelector:
252264
{{- toYaml . | nindent 8 }}

charts/keycloak/values.schema.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,19 @@
284284
}
285285
}
286286
},
287+
"realm": {
288+
"type": "object",
289+
"properties": {
290+
"import": {
291+
"type": "boolean",
292+
"description": "Enable import of realms from /opt/keycloak/data/import (production mode must be false)"
293+
},
294+
"configFile": {
295+
"type": "string",
296+
"description": "Json config for initial realm configuration, mounted in /opt/keycloak/data/import"
297+
}
298+
}
299+
},
287300
"features": {
288301
"type": "object",
289302
"properties": {

charts/keycloak/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ cache:
143143
## @param cache.configFile Custom cache configuration file
144144
configFile: ""
145145

146+
## @section Realm Configuration
147+
realm:
148+
## @param realm.import Enable import of realms from /opt/keycloak/data/import (production mode must be false)
149+
import: false
150+
## @param realm.configFile Json config for initial realm configuration, mounted in /opt/keycloak/data/import
151+
configFile: ""
152+
146153
## @section Features Configuration
147154
features:
148155
## @param features.enabled List of enabled features

0 commit comments

Comments
 (0)