diff --git a/charts/synatainer/Chart.yaml b/charts/synatainer/Chart.yaml index 021a19a..8f1fff7 100644 --- a/charts/synatainer/Chart.yaml +++ b/charts/synatainer/Chart.yaml @@ -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 diff --git a/charts/synatainer/templates/_helpers.tpl b/charts/synatainer/templates/_helpers.tpl index ea16046..e4bc088 100644 --- a/charts/synatainer/templates/_helpers.tpl +++ b/charts/synatainer/templates/_helpers.tpl @@ -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 }} diff --git a/charts/synatainer/templates/config.yaml b/charts/synatainer/templates/config.yaml index c0d46b9..4a78b18 100644 --- a/charts/synatainer/templates/config.yaml +++ b/charts/synatainer/templates/config.yaml @@ -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 }} diff --git a/charts/synatainer/templates/deployment.yaml b/charts/synatainer/templates/deployment.yaml index b8620f1..8f42972 100644 --- a/charts/synatainer/templates/deployment.yaml +++ b/charts/synatainer/templates/deployment.yaml @@ -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: {} diff --git a/charts/synatainer/templates/secret.yaml b/charts/synatainer/templates/secret.yaml index e56ddc0..989969d 100644 --- a/charts/synatainer/templates/secret.yaml +++ b/charts/synatainer/templates/secret.yaml @@ -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 }} diff --git a/charts/synatainer/values.yaml b/charts/synatainer/values.yaml index 1f6ac41..1e9a854 100644 --- a/charts/synatainer/values.yaml +++ b/charts/synatainer/values.yaml @@ -9,6 +9,7 @@ image: ## Connection details for the Synapse database postgresql: host: + # port: 5432 # database: synapse # username: synapse password: