Преглед на файлове

check if a db-user exists in a secret and use that

Stavros Kois преди 2 години
родител
ревизия
7c0a1d53c1
променени са 2 файла, в които са добавени 20 реда и са изтрити 0 реда
  1. 10 0
      charts/nextcloud/1.6.15/templates/postgres-secret.yaml
  2. 10 0
      test/nextcloud/1.6.15/templates/postgres-secret.yaml

+ 10 - 0
charts/nextcloud/1.6.15/templates/postgres-secret.yaml

@@ -4,7 +4,17 @@ kind: Secret
 metadata:
   name: {{ $secretName }}
 data:
+  {{/*
+  Lookup for the user shouldn't be needed in normal circumstances
+  But there was a typo before that resulted to a db-user with weird
+  characters. So to keep that user for existing installations we retrieve
+  it from the existing secret.
+  */}}
+  {{ with (lookup "v1" "Secret" .Release.Namespace $secretName)}}
+  db-user: {{ index .data "db-user" }}
+  {{ else }}
   db-user: {{ (include "postgres.DatabaseName" .Values ) | b64enc }}
+  {{ end }}
   {{ with (lookup "v1" "Secret" .Release.Namespace $secretName) }}
   db-password: {{ index .data "db-password" }}
   {{ else }}

+ 10 - 0
test/nextcloud/1.6.15/templates/postgres-secret.yaml

@@ -4,7 +4,17 @@ kind: Secret
 metadata:
   name: {{ $secretName }}
 data:
+  {{/*
+  Lookup for the user shouldn't be needed in normal circumstances
+  But there was a typo before that resulted to a db-user with weird
+  characters. So to keep that user for existing installations we retrieve
+  it from the existing secret.
+  */}}
+  {{ with (lookup "v1" "Secret" .Release.Namespace $secretName)}}
+  db-user: {{ index .data "db-user" }}
+  {{ else }}
   db-user: {{ (include "postgres.DatabaseName" .Values ) | b64enc }}
+  {{ end }}
   {{ with (lookup "v1" "Secret" .Release.Namespace $secretName) }}
   db-password: {{ index .data "db-password" }}
   {{ else }}