aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-12-11 11:53:42 +0100
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-12-17 15:05:00 +0100
commit0b243b600f5c9c296189d66161a814396d648563 (patch)
tree59fc3d88a616ee582c51dd8a747c75e1e9ee6ffb /kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml
parent8501d7cee5a887f9e19d5fe3671ef8180bce526b (diff)
[COMMON] Use deployment for postgresql
Instead of statefulset + inner work in the container, use deployments in order to be more reliable Change-Id: Icf4fe1303ae3489c822558e28bb08b69af2d4970 Issue-ID: OOM-2234 Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Diffstat (limited to 'kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml')
-rw-r--r--kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml34
1 files changed, 33 insertions, 1 deletions
diff --git a/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml b/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml
index 15fa18d81d..a4b0ca8657 100644
--- a/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml
+++ b/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml
@@ -31,6 +31,33 @@ spec:
app: {{ include "common.name" . }}
release: {{ .Release.Name }}
spec:
+ initContainers:
+ - name: {{ include "common.name" . }}-job
+ image: "{{.Values.repository}}/{{.Values.image}}"
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ volumeMounts:
+ - name: pgpool-pgconf
+ mountPath: /pgconf/pgpoolconfigdir
+ readOnly: false
+ - name: pgpool-pgconf-static
+ mountPath: /configdir/
+ readOnly: false
+ command:
+ - /bin/sh
+ args:
+ - -c
+ - |
+ cp /configdir/pgpool.conf /pgconf/pgpoolconfigdir/
+ cp /configdir/pool_hba.conf /pgconf/pgpoolconfigdir/
+ pg_md5 -f /pgconf/pgpoolconfigdir/pgpool.conf --md5auth --username=${PG_USER} ${PG_PASSWORD}
+ env:
+ - name: PG_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ template "common.fullname" . }}
+ key: db-user-password
+ - name: PG_USER
+ value: {{ index .Values.credentials.pgusername }}
containers:
- image: "{{.Values.repository}}/{{.Values.image}}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
@@ -43,7 +70,10 @@ spec:
- name: PG_USERNAME
value: {{.Values.credentials.pgusername}}
- name: PG_PASSWORD
- value: {{.Values.credentials.pgpassword}}
+ valueFrom:
+ secretKeyRef:
+ name: {{ template "common.fullname" . }}
+ key: db-user-password
ports:
- containerPort: 5432
name: pgpool
@@ -64,5 +94,7 @@ spec:
readOnly: false
volumes:
- name: pgpool-pgconf
+ emptyDir: {}
+ - name: pgpool-pgconf-static
configMap:
name: {{ include "common.fullname" . }}-pgpool-configmap