diff --git a/charts/sogo/Chart.yaml b/charts/sogo/Chart.yaml index a0aef2a..bf05fa7 100644 --- a/charts/sogo/Chart.yaml +++ b/charts/sogo/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: sogo -version: 0.1.6 +version: 0.1.7 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 2a0f81a..7fb47aa 100644 --- a/charts/sogo/ci/existing-secrets-values.yaml +++ b/charts/sogo/ci/existing-secrets-values.yaml @@ -13,4 +13,4 @@ sogo: SOGoTimeZone: America/Montreal WOWorkersCount: 5 existingSecrets: - - test-secret + - name: test-secret diff --git a/charts/sogo/templates/deployment.yaml b/charts/sogo/templates/deployment.yaml index b99f7fa..627cb60 100644 --- a/charts/sogo/templates/deployment.yaml +++ b/charts/sogo/templates/deployment.yaml @@ -227,8 +227,12 @@ spec: mountPath: /secrets {{- if .Values.sogo.existingSecrets }} {{- range .Values.sogo.existingSecrets }} - - name: {{ printf "existing-secrets-%s" (kebabcase .) }} - mountPath: {{ printf "/existing-secrets/%s" (kebabcase .) }} + - name: {{ printf "existing-secrets-%s" (kebabcase .name) }} + {{- if .yaml }} + mountPath: {{ printf "/existing-secrets/%s__yaml" (kebabcase .name) }} + {{- else }} + mountPath: {{ printf "/existing-secrets/%s" (kebabcase .name) }} + {{- end }} readOnly: true {{- end }} {{- end }} @@ -249,13 +253,24 @@ spec: # Loop through each file in the directory # Find all files within the existing-secrets directory and its subdirectories find /existing-secrets -type f | while read -r file; do + is_yaml=false + # Get the filename without the directory path filename=$(basename "$file") + if [[ $filename == *"__yaml" ]]; then + is_yaml=true + filename="${filename/__yaml/}" + fi + # 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 if the content is not empty if [ -n "$content" ]; then - echo "$filename: |-" >> "$output_file" + if [ "$is_yaml" = true ]; then + echo "$filename:" >> "$output_file" + else + echo "$filename: |-" >> "$output_file" + fi while IFS= read -r line; do echo " $line" >> "$output_file" done <<< "$content" @@ -365,9 +380,9 @@ spec: {{- end }} {{- if .Values.sogo.existingSecrets }} {{- range .Values.sogo.existingSecrets }} - - name: {{ printf "existing-secrets-%s" (kebabcase .) }} + - name: {{ printf "existing-secrets-%s" (kebabcase .name) }} secret: - secretName: {{ . }} + secretName: {{ .name }} {{- end }} {{- end }} - name: {{ template "sogo.fullname" . }}-tmp diff --git a/charts/sogo/values.yaml b/charts/sogo/values.yaml index 47ef240..e4b7401 100644 --- a/charts/sogo/values.yaml +++ b/charts/sogo/values.yaml @@ -84,8 +84,12 @@ sogo: # OCSStoreURL: "mysql://sogo:pass@db:3306/sogo/sogo_store" # OCSAclURL: "mysql://sogo:pass@db:3306/sogo/sogo_acl" - # Array of secret names containing the configurations + # Array of secrets containing the configurations existingSecrets: [] + # - name: secretName + # - name: secretName2 + # yaml: true + ### having yaml set to true would parse the secret as a yaml file ## SOGo Custom Theming ## NOTE: SOGoUIxDebugEnabled is automatically set to YES when only .sogo.theme.js is set