diff --git a/charts/matrix-authentication-service/templates/db-init.yaml b/charts/matrix-authentication-service/templates/db-init.yaml new file mode 100644 index 0000000..bd86174 --- /dev/null +++ b/charts/matrix-authentication-service/templates/db-init.yaml @@ -0,0 +1,20 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "matrix-authentication-service.fullname" . }}-db-init + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + template: + spec: + restartPolicy: Never + containers: + - name: general-db-init + image: "{{ .Values.initContainers.dbInit.image.repository }}:{{ .Values.initContainers.dbInit.image.tag }}" + envFrom: + - secretRef: + name: {{ .Values.postgres.secretName }} + backoffLimit: 3 diff --git a/charts/matrix-authentication-service/values.yaml b/charts/matrix-authentication-service/values.yaml index 9ecc361..fb8baa5 100644 --- a/charts/matrix-authentication-service/values.yaml +++ b/charts/matrix-authentication-service/values.yaml @@ -3,6 +3,18 @@ fullnameOverride: "" existingSecretConfigMap: matrix-authentication-service-secret +postgres: + secretName: matrix-authentication-service-secret + +initContainers: + dbInit: + image: + repository: ghcr.io/onedr0p/postgres-init + tag: "16" + envFrom: + - secretRef: + name: matrix-authentication-service-secret + image: registry: ghcr.io repository: matrix-org/matrix-authentication-service