From 74fb92801f3fad20d9cac4da8754905e290e6623 Mon Sep 17 00:00:00 2001 From: Arano-kai Date: Tue, 13 Feb 2024 16:25:13 +0200 Subject: [PATCH] feat(helpers): sort schema apply sequence Custom schema filenames are inserted into LDAP_EXTRA_SCHEMAS in an unsorted fashion, causing inconsistencies every time a new schema is added, or even in a different version of the helm. This commit enable customSchemaFiles keys sorting, allowing control over the loading sequence and using dependent custom schemas. --- templates/_helpers.tpl | 2 +- values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index c3c51b4..bc650de 100755 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -188,7 +188,7 @@ Cannot return list => return string comma separated */}} {{- define "openldap.customSchemaFiles" -}} {{- $schemas := "" -}} - {{- $schemas := ((join "," (.Values.customSchemaFiles | keys)) | replace ".ldif" "") -}} + {{- $schemas := ((join "," (.Values.customSchemaFiles | keys | sortAlpha)) | replace ".ldif" "") -}} {{- print $schemas -}} {{- end -}} diff --git a/values.yaml b/values.yaml index e6554a9..5f6a894 100644 --- a/values.yaml +++ b/values.yaml @@ -121,6 +121,8 @@ pdb: # group: readers # Custom openldap schema files used to be used in addition to default schemas +# Note that the supplied files are sorted by name and inserted into 'LDAP_EXTRA_SCHEMAS' env var +# after chart default schemas, allowing you to control the loading sequence. # customSchemaFiles: # custom.ldif: |- # # custom schema