synatainer: Update to 0.4.1

This switches to generating a pgpassfile instead of handing over
postgres configuration in the environment
This commit is contained in:
Alexander "Ace" Olofsson 2022-08-16 07:51:35 +02:00
parent 927567318a
commit a34b47f9b7
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
6 changed files with 36 additions and 7 deletions

View file

@ -5,8 +5,8 @@ description: Synapse Maintenance Container
home: https://gitlab.com/mb-saces/synatainer
type: application
version: 1.0.0
appVersion: "0.4.0"
version: 1.1.0
appVersion: 0.4.1
maintainers:
- name: Alexander Olofsson

View file

@ -49,3 +49,7 @@ Selector labels
app.kubernetes.io/name: {{ include "synatainer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "synatainer.pgpassword" -}}
{{- printf "%s:%s:%s:%s" (required "You need to specify a postgres host" .Values.postgresql.host) (.Values.postgresql.port | default 5432 | toString) (.Values.postgresql.database | default "synapse") (.Values.postgresql.username | default "synapse") (required "You need to specify a postgres password" .Values.postgresql.password) }}
{{- end }}

View file

@ -6,9 +6,6 @@ metadata:
labels:
{{- include "synatainer.labels" . | nindent 4 }}
data:
DB_HOST: {{ required "You need to specify a postgres host" .Values.postgresql.host | quote }}
DB_NAME: {{ .Values.postgresql.database | default "synapse" | quote }}
DB_USER: {{ .Values.postgresql.username | default "synapse" | quote }}
SYNAPSE_HOST: {{ .Values.synapse.url | default "http://matrix-synapse:8008" | quote }}
{{- range $key, $val := .Values.extraEnv }}

View file

@ -29,7 +29,13 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
- command:
- sh
- -c
- |
cp /tmp/pgpassword /conf/
exec /entrypoint.sh
name: {{ .Chart.Name }}
envFrom:
- configMapRef:
name: {{ include "synatainer.fullname" . }}
@ -41,6 +47,12 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: emptydir
mountPath: /conf
- name: pgpassword
mountPath: /tmp/pgpassword
subPath: pgpassword
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@ -53,3 +65,10 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: pgpassword
secret:
secretName: {{ include "synatainer.fullname" . }}-pgpass
defaultMode: 0600
- name: emptydir
emptyDir: {}

View file

@ -1,12 +1,20 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "synatainer.fullname" . }}-pgpass
labels:
{{- include "synatainer.labels" . | nindent 4 }}
data:
pgpassword: {{ include "synatainer.pgpassword" . | b64enc }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "synatainer.fullname" . }}
labels:
{{- include "synatainer.labels" . | nindent 4 }}
data:
PGPASSWORD: {{ required "You need to specify a postgres password" .Values.postgresql.password | toString | b64enc }}
BEARER_TOKEN: {{ required "You need to specify a synapse token" .Values.synapse.token | toString | b64enc }}
{{- range $key, $val := .Values.extraSecrets }}

View file

@ -9,6 +9,7 @@ image:
## Connection details for the Synapse database
postgresql:
host:
# port: 5432
# database: synapse
# username: synapse
password: