From a8578abaa61e33a6c3add803fa1b82e41518340b Mon Sep 17 00:00:00 2001 From: shcherbak Date: Thu, 22 Aug 2024 23:19:17 +0300 Subject: [PATCH 1/4] ldap-sync --- charts/ldap-sync/Chart.yaml | 3 +++ charts/ldap-sync/templates/cron.yaml | 0 charts/ldap-sync/values.yaml | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 charts/ldap-sync/Chart.yaml create mode 100644 charts/ldap-sync/templates/cron.yaml create mode 100644 charts/ldap-sync/values.yaml diff --git a/charts/ldap-sync/Chart.yaml b/charts/ldap-sync/Chart.yaml new file mode 100644 index 0000000..24d10ec --- /dev/null +++ b/charts/ldap-sync/Chart.yaml @@ -0,0 +1,3 @@ +--- +name: ldap-sync +version: 0.0.1 diff --git a/charts/ldap-sync/templates/cron.yaml b/charts/ldap-sync/templates/cron.yaml new file mode 100644 index 0000000..e69de29 diff --git a/charts/ldap-sync/values.yaml b/charts/ldap-sync/values.yaml new file mode 100644 index 0000000..1a9fe0a --- /dev/null +++ b/charts/ldap-sync/values.yaml @@ -0,0 +1,10 @@ +image: + repository: "" + tag: "" + pullPolicy: IfNotPresent +replicas: 1 +servers: [] +resources: {} +nodeSelector: {} +tolerations: [] +affinity: {} From c9fc735123bd481a99e7e656fe8f3764c0c1fd22 Mon Sep 17 00:00:00 2001 From: shcherbak Date: Thu, 22 Aug 2024 23:19:39 +0300 Subject: [PATCH 2/4] fix --- charts/ldap-sync/values.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/ldap-sync/values.yaml b/charts/ldap-sync/values.yaml index 1a9fe0a..df64e19 100644 --- a/charts/ldap-sync/values.yaml +++ b/charts/ldap-sync/values.yaml @@ -2,8 +2,6 @@ image: repository: "" tag: "" pullPolicy: IfNotPresent -replicas: 1 -servers: [] resources: {} nodeSelector: {} tolerations: [] From 5e49af8eb3a033a0c642e8bbf1c72a4e98160dcd Mon Sep 17 00:00:00 2001 From: shcherbak Date: Thu, 5 Sep 2024 01:04:29 +0300 Subject: [PATCH 3/4] init --- charts/ldap-sync/templates/cron.yaml | 41 ++++++++++++++++++++++++++++ charts/ldap-sync/values.yaml | 16 +++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/charts/ldap-sync/templates/cron.yaml b/charts/ldap-sync/templates/cron.yaml index e69de29..ad07803 100644 --- a/charts/ldap-sync/templates/cron.yaml +++ b/charts/ldap-sync/templates/cron.yaml @@ -0,0 +1,41 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: ldap-sync +spec: + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 3 + concurrencyPolicy: Forbid + schedule: {{ .Values.cronSchedule | quote }} + jobTemplate: + spec: + activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }} + backoffLimit: 1 + parallelism: 1 + template: + metadata: + labels: + cronjob: ldap-sync + spec: + activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }} + serviceAccountName: ldap-sync + restartPolicy: Never + containers: + - name: backup + image: {{ printf "%s:%s".Values.image.repository .Values.image.tag | quote }} + command: ["/opt/matrix-ldap-sync/matrix-ldap-sync"] + #env: {} + resources: + {{ toYaml .Values.synapse.pgbouncer.resources | nindent 16 }} + {{- if .Values.nodeSelector }} + nodeSelector: + {{ toYaml .Values.nodeSelector | nindent 12 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: + {{ toYaml .Values.tolerations | nindent 12 }} + {{- end }} + {{- if .Values.affinity }} + affinity: + {{ toYaml .Values.affinity | nindent 12 }} + {{- end }} diff --git a/charts/ldap-sync/values.yaml b/charts/ldap-sync/values.yaml index df64e19..833cc4e 100644 --- a/charts/ldap-sync/values.yaml +++ b/charts/ldap-sync/values.yaml @@ -1,8 +1,20 @@ image: - repository: "" - tag: "" + repository: "jushcherbak/matrix-ldap-sync" + tag: "0.0.1" pullPolicy: IfNotPresent +cronSchedule: "0 2 * * *" +activeDeadlineSeconds: 21600 resources: {} nodeSelector: {} tolerations: [] affinity: {} +env: + LDAP_URL: '' + LDAP_BIND_DN: '' + LDAP_BIND_PASSWD: '' + LDAP_BASE: '' + LDAP_FILTER: '' + SYNAPSE_HOMESERVER_URL: '' + SYNAPSE_USER_ID: '' + SYNAPSE_ACCESS_TOKEN: '' + DO_REAL_JOB: false From 991c8b7b9e9a8dda38649e77559ef586f59e62b5 Mon Sep 17 00:00:00 2001 From: shcherbak Date: Thu, 5 Sep 2024 10:38:07 +0300 Subject: [PATCH 4/4] ldap sync --- charts/ldap-sync/templates/configmap.yaml | 8 ++++++++ charts/ldap-sync/templates/cron.yaml | 6 +++++- charts/ldap-sync/templates/secret.yaml | 9 +++++++++ charts/ldap-sync/values.yaml | 9 +++++---- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 charts/ldap-sync/templates/configmap.yaml create mode 100644 charts/ldap-sync/templates/secret.yaml diff --git a/charts/ldap-sync/templates/configmap.yaml b/charts/ldap-sync/templates/configmap.yaml new file mode 100644 index 0000000..425308a --- /dev/null +++ b/charts/ldap-sync/templates/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: ldap-sync +data: +{{- range $k, $v := .Values.configs }} + {{ $k }}: {{ $v }} +{{- end }} diff --git a/charts/ldap-sync/templates/cron.yaml b/charts/ldap-sync/templates/cron.yaml index ad07803..1d2b306 100644 --- a/charts/ldap-sync/templates/cron.yaml +++ b/charts/ldap-sync/templates/cron.yaml @@ -24,9 +24,13 @@ spec: - name: backup image: {{ printf "%s:%s".Values.image.repository .Values.image.tag | quote }} command: ["/opt/matrix-ldap-sync/matrix-ldap-sync"] - #env: {} resources: {{ toYaml .Values.synapse.pgbouncer.resources | nindent 16 }} + envFrom: + - configMapRef: + name: ldap-sync + - secretRef: + name: ldap-sync {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }} diff --git a/charts/ldap-sync/templates/secret.yaml b/charts/ldap-sync/templates/secret.yaml new file mode 100644 index 0000000..1de859c --- /dev/null +++ b/charts/ldap-sync/templates/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: ldap-sync +type: Opaque +data: + {{- range $k, $v := .Values.secrets }} + {{ $k }}: {{ $v | toString | b64enc }} + {{- end }} diff --git a/charts/ldap-sync/values.yaml b/charts/ldap-sync/values.yaml index 833cc4e..0cb8e95 100644 --- a/charts/ldap-sync/values.yaml +++ b/charts/ldap-sync/values.yaml @@ -8,13 +8,14 @@ resources: {} nodeSelector: {} tolerations: [] affinity: {} -env: +configs: LDAP_URL: '' - LDAP_BIND_DN: '' - LDAP_BIND_PASSWD: '' LDAP_BASE: '' LDAP_FILTER: '' SYNAPSE_HOMESERVER_URL: '' + DO_REAL_JOB: false +secrets: + LDAP_BIND_DN: '' + LDAP_BIND_PASSWD: '' SYNAPSE_USER_ID: '' SYNAPSE_ACCESS_TOKEN: '' - DO_REAL_JOB: false