diff --git a/charts/sogo/Chart.yaml b/charts/sogo/Chart.yaml index 29cfe44..a0aef2a 100644 --- a/charts/sogo/Chart.yaml +++ b/charts/sogo/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: sogo -version: 0.1.5 +version: 0.1.6 description: A helm chart for the docker-sogo docker image type: application keywords: diff --git a/charts/sogo/ci/existing-secrets-values.yaml b/charts/sogo/ci/existing-secrets-values.yaml index a90fac6..2a0f81a 100644 --- a/charts/sogo/ci/existing-secrets-values.yaml +++ b/charts/sogo/ci/existing-secrets-values.yaml @@ -12,4 +12,5 @@ sogo: SOGoLanguage: English SOGoTimeZone: America/Montreal WOWorkersCount: 5 - existingSecrets: test-secret + existingSecrets: + - test-secret diff --git a/charts/sogo/templates/deployment.yaml b/charts/sogo/templates/deployment.yaml index c6e1c70..b99f7fa 100644 --- a/charts/sogo/templates/deployment.yaml +++ b/charts/sogo/templates/deployment.yaml @@ -226,10 +226,12 @@ spec: - name: {{ template "sogo.fullname" . }}-tmp mountPath: /secrets {{- if .Values.sogo.existingSecrets }} - - name: existing-secrets - mountPath: /existing-secrets + {{- range .Values.sogo.existingSecrets }} + - name: {{ printf "existing-secrets-%s" (kebabcase .) }} + mountPath: {{ printf "/existing-secrets/%s" (kebabcase .) }} readOnly: true {{- end }} + {{- end }} command: - "sh" - "-c" @@ -239,20 +241,24 @@ spec: touch "$tmp_script" cat << 'EOF' > "$tmp_script" - #!/bin/sh + #!/bin/bash output_file="/secrets/existing-secrets.yaml" > "$output_file" # Loop through each file in the directory - for file in /existing-secrets/*; do + # Find all files within the existing-secrets directory and its subdirectories + find /existing-secrets -type f | while read -r file; do # Get the filename without the directory path filename=$(basename "$file") - # Read the content of the file + # Read the content of the file and indent each line with two spaces content=$(cat "$file") - # Append the filename and content to the YAML file + # Append the filename and content to the YAML file if the content is not empty if [ -n "$content" ]; then - echo "$filename: $content" >> "$output_file" + echo "$filename: |-" >> "$output_file" + while IFS= read -r line; do + echo " $line" >> "$output_file" + done <<< "$content" fi done EOF @@ -260,7 +266,7 @@ spec: chmod +x "$tmp_script" # Generation of config file - sh "$tmp_script" + bash "$tmp_script" {{- if or .Values.mariadb.enabled (eq (include "sogo.db.parsed.type" .) "mysql") }} - name: mariadb-isalive @@ -358,9 +364,11 @@ spec: secretName: {{ template "sogo.fullname" . }}-secret {{- end }} {{- if .Values.sogo.existingSecrets }} - - name: existing-secrets + {{- range .Values.sogo.existingSecrets }} + - name: {{ printf "existing-secrets-%s" (kebabcase .) }} secret: - secretName: {{ .Values.sogo.existingSecrets }} + secretName: {{ . }} + {{- end }} {{- end }} - name: {{ template "sogo.fullname" . }}-tmp emptyDir: {} diff --git a/charts/sogo/values.yaml b/charts/sogo/values.yaml index ddf5fb7..47ef240 100644 --- a/charts/sogo/values.yaml +++ b/charts/sogo/values.yaml @@ -84,8 +84,8 @@ sogo: # OCSStoreURL: "mysql://sogo:pass@db:3306/sogo/sogo_store" # OCSAclURL: "mysql://sogo:pass@db:3306/sogo/sogo_acl" - # Name of Secret containing the configurations - existingSecrets: + # Array of secret names containing the configurations + existingSecrets: [] ## SOGo Custom Theming ## NOTE: SOGoUIxDebugEnabled is automatically set to YES when only .sogo.theme.js is set