(feat) move postgresql init and password-generator to common (#1113)
* Move Postgresql initcontainer to common * bump common * Handle postgres password generation in common and inject into values.yaml for use in Apps * (refactor) adapt apps using postgresql to common init and password generator * no message
This commit is contained in:
@@ -8,11 +8,6 @@ image:
|
||||
pullPolicy: IfNotPresent
|
||||
tag: v5.2.0@sha256:8fc7bb87b77d76d929bcd36403d4f27878fa3e99f5448fb05ed64829078665a4
|
||||
|
||||
postgresqlImage:
|
||||
repository: bitnami/postgresql
|
||||
pullPolicy: IfNotPresent
|
||||
tag: 13.4.0@sha256:e7526fc32deec708740784d907bcea2ef6c78bc5ab5265026eff96e70082a54a
|
||||
|
||||
initContainers:
|
||||
migrate-db:
|
||||
image: "{{ .Values.alpineImage.repository}}:{{ .Values.alpineImage.tag }}"
|
||||
@@ -43,7 +38,6 @@ postgresql:
|
||||
enabled: true
|
||||
postgresqlUsername: sogo
|
||||
postgresqlDatabase: sogo
|
||||
existingSecret: dbcreds
|
||||
|
||||
# -- memcached dependency settings
|
||||
memcached:
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
{{/* Define the configmap */}}
|
||||
{{- define "sogo.config" -}}
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
name: dbcreds
|
||||
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "dbcreds" }}
|
||||
{{- $dbPass := "" }}
|
||||
data:
|
||||
{{- if $dbprevious }}
|
||||
{{- $dbPass = ( index $dbprevious.data "postgresql-password" ) | b64dec }}
|
||||
postgresql-password: {{ ( index $dbprevious.data "postgresql-password" ) }}
|
||||
postgresql-postgres-password: {{ ( index $dbprevious.data "postgresql-postgres-password" ) }}
|
||||
{{- else }}
|
||||
{{- $dbPass = randAlphaNum 50 }}
|
||||
postgresql-password: {{ $dbPass | b64enc | quote }}
|
||||
postgresql-postgres-password: {{ randAlphaNum 50 | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- $url := printf "%v%v:%v@%v-%v:%v/%v" "postgresql://" .Values.postgresql.postgresqlUsername $dbPass .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase }}
|
||||
url: {{ $url | b64enc | quote }}
|
||||
plainhost: {{ ( printf "%v-%v" .Release.Name "postgresql" ) | b64enc | quote }}
|
||||
type: Opaque
|
||||
|
||||
---
|
||||
|
||||
@@ -51,9 +27,9 @@ data:
|
||||
* **************************************************************************/
|
||||
|
||||
/* Database configuration (mysql:// or postgresql://) */
|
||||
SOGoProfileURL = "{{ $url }}/sogo_user_profile";
|
||||
OCSFolderInfoURL = "{{ $url }}/sogo_folder_info";
|
||||
OCSSessionsFolderURL = "{{ $url }}/sogo_sessions_folder";
|
||||
SOGoProfileURL = "{{ .Values.postgresql.url.complete }}/sogo_user_profile";
|
||||
OCSFolderInfoURL = "{{ .Values.postgresql.url.complete }}/sogo_folder_info";
|
||||
OCSSessionsFolderURL = "{{ .Values.postgresql.url.complete }}/sogo_sessions_folder";
|
||||
|
||||
/* Mail */
|
||||
SOGoDraftsFolderName = {{ .Values.sogo.mail.SOGoDraftsFolderName | default "Drafts" }};
|
||||
|
||||
@@ -12,11 +12,6 @@ podSecurityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
|
||||
postgresqlImage:
|
||||
repository: bitnami/postgresql
|
||||
pullPolicy: IfNotPresent
|
||||
tag: 13.4.0@sha256:e7526fc32deec708740784d907bcea2ef6c78bc5ab5265026eff96e70082a54a
|
||||
|
||||
# -- services
|
||||
service:
|
||||
main:
|
||||
@@ -24,23 +19,6 @@ service:
|
||||
main:
|
||||
port: 80
|
||||
|
||||
# -- initcontainers
|
||||
initContainers:
|
||||
# -- wait for database before starting sogo
|
||||
init-postgresdb:
|
||||
image: "{{ .Values.postgresqlImage.repository }}:{{ .Values.postgresqlImage.tag }}"
|
||||
command:
|
||||
- "sh"
|
||||
- "-c"
|
||||
- "until pg_isready -U sogo -h ${pghost} ; do sleep 2 ; done"
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: pghost
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: dbcreds
|
||||
key: plainhost
|
||||
|
||||
# -- persistence settings
|
||||
persistence:
|
||||
data:
|
||||
@@ -66,7 +44,6 @@ postgresql:
|
||||
enabled: true
|
||||
postgresqlUsername: sogo
|
||||
postgresqlDatabase: sogo
|
||||
existingSecret: dbcreds
|
||||
|
||||
# -- memcached dependency settings
|
||||
memcached:
|
||||
|
||||
Reference in New Issue
Block a user