Skip to content

Commit 6f3a9e8

Browse files
authored
added keycloak-sync chart (#19)
welcome keycloak-sync chart
1 parent 33db0f1 commit 6f3a9e8

4 files changed

Lines changed: 111 additions & 0 deletions

File tree

charts/keycloak-sync/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: keycloak-sync
3+
description: Master Helm chart for sync users from specific group in KeyCloak to Matrix
4+
version: 0.0.1
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: {{ .Chart.Name }}
5+
spec:
6+
successfulJobsHistoryLimit: 1
7+
failedJobsHistoryLimit: 3
8+
concurrencyPolicy: Forbid
9+
schedule: {{ .Values.cronSchedule | quote }}
10+
jobTemplate:
11+
spec:
12+
activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
13+
backoffLimit: 1
14+
parallelism: 1
15+
template:
16+
metadata:
17+
labels:
18+
cronjob: {{ .Chart.Name }}
19+
spec:
20+
activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
21+
restartPolicy: Never
22+
containers:
23+
- name: {{ .Chart.Name }}
24+
image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag | quote }}
25+
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
command:
27+
- bash
28+
- -c
29+
- {{ printf "%s/keycloak_matrix_sync.sh" .Values.configs.script_home | quote }}
30+
{{- if .Values.resources }}
31+
resources:
32+
{{ toYaml .Values.resources | nindent 16 }}
33+
{{- end }}
34+
volumeMounts:
35+
- name: {{ .Chart.Name }}
36+
mountPath: "{{.Values.configs.script_home}}/keycloak_matrix_sync.conf"
37+
subPath: keycloak_matrix_sync.conf
38+
- name: {{ .Chart.Name }}
39+
mountPath: "{{.Values.configs.script_home}}/mas-config.yaml"
40+
subPath: mas-database.yaml
41+
volumes:
42+
- name: {{ .Chart.Name }}
43+
secret:
44+
secretName: {{ .Chart.Name }}
45+
{{- if .Values.nodeSelector }}
46+
nodeSelector:
47+
{{ toYaml .Values.nodeSelector | nindent 12 }}
48+
{{- end }}
49+
{{- if .Values.tolerations }}
50+
tolerations:
51+
{{ toYaml .Values.tolerations | nindent 12 }}
52+
{{- end }}
53+
{{- if .Values.affinity }}
54+
affinity:
55+
{{ toYaml .Values.affinity | nindent 12 }}
56+
{{- end }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ .Chart.Name }}
5+
type: Opaque
6+
stringData:
7+
mas-database.yaml: |
8+
database:
9+
connect_timeout: 30
10+
database: {{ .Values.configs.mas.db_name }}
11+
host: {{ .Values.configs.mas.db_host }}
12+
idle_timeout: 600
13+
max_connections: 10
14+
max_lifetime: 1800
15+
min_connections: 0
16+
password: {{ .Values.configs.mas.db_pass }}
17+
port: {{ .Values.configs.mas.db_port }}
18+
username: mas_user
19+
20+
keycloak_matrix_sync.conf: |
21+
{{- range $k, $v := .Values.configs.sync }}
22+
{{ $k }}={{ $v | toString }}
23+
{{- end }}

charts/keycloak-sync/values.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
image:
2+
repository: "ghcr.io/code-tool/matrix-keycloak-sync"
3+
tag: "0.0.1"
4+
pullPolicy: IfNotPresent
5+
cronSchedule: "*/20 * * * *"
6+
activeDeadlineSeconds: 1000
7+
resources: {}
8+
nodeSelector: {}
9+
tolerations: []
10+
affinity: {}
11+
configs:
12+
mas:
13+
db_name: ''
14+
db_pass: ''
15+
db_host: ''
16+
db_port: ''
17+
sync:
18+
KC_URL: ''
19+
KC_REALM: ''
20+
KC_CLIENT_ID: ''
21+
KC_ADMIN_USER: ''
22+
KC_ADMIN_PASS: ''
23+
KC_GROUP_NAME: ''
24+
MATRIX_URL: ''
25+
MATRIX_ADMIN_TOKEN: ''
26+
MATRIX_SERVER_NAME: ''
27+
DRY_RUN: ''
28+
script_home: '/opt/sync'

0 commit comments

Comments
 (0)