[ONAP-wide] Replace .Release.Name with common.release
[oom.git] / kubernetes / common / postgres / charts / pgpool / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 Amdocs, AT&T, Bell Canada
3 # #
4 # # Licensed under the Apache License, Version 2.0 (the "License");
5 # # you may not use this file except in compliance with the License.
6 # # You may obtain a copy of the License at
7 # #
8 # #       http://www.apache.org/licenses/LICENSE-2.0
9 # #
10 # # Unless required by applicable law or agreed to in writing, software
11 # # distributed under the License is distributed on an "AS IS" BASIS,
12 # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # # See the License for the specific language governing permissions and
14 # # limitations under the License.
15 */}}
16 kind: Deployment
17 apiVersion: extensions/v1beta1
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: 2
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ include "common.release" . }}
33     spec:
34       initContainers:
35       - name: {{ include "common.name" . }}-job
36         image: "{{.Values.repository}}/{{.Values.image}}"
37         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38         volumeMounts:
39         - name: pgpool-pgconf
40           mountPath: /pgconf/pgpoolconfigdir
41           readOnly: false
42         - name: pgpool-pgconf-static
43           mountPath: /configdir/
44           readOnly: false
45         command:
46         - /bin/sh
47         args:
48         - -c
49         - |
50           cp /configdir/pgpool.conf   /pgconf/pgpoolconfigdir/
51           cp /configdir/pool_hba.conf /pgconf/pgpoolconfigdir/
52           pg_md5 -f /pgconf/pgpoolconfigdir/pgpool.conf --md5auth --username=${PG_USER} ${PG_PASSWORD} 
53         env:
54         - name: PG_PASSWORD
55           valueFrom:
56             secretKeyRef:
57               name: {{ template "common.fullname" . }}
58               key: db-user-password
59         - name: PG_USER
60           value: {{ index .Values.credentials.pgusername }}
61       containers:
62       - image: "{{.Values.repository}}/{{.Values.image}}"
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         name: {{ include "common.name" . }}
65         env:
66         - name: PG_PRIMARY_SERVICE_NAME
67           value: {{.Values.container.name.primary}}
68         - name: PG_REPLICA_SERVICE_NAME
69           value: {{.Values.container.name.replica}}
70         - name: PG_USERNAME
71           value: {{.Values.credentials.pgusername}}
72         - name: PG_PASSWORD
73           valueFrom:
74             secretKeyRef:
75               name: {{ template "common.fullname" . }}
76               key: db-user-password
77         ports:
78         - containerPort: 5432
79           name: pgpool
80           protocol: TCP
81         readinessProbe:
82           tcpSocket:
83             port: 5432
84           initialDelaySeconds: 20
85           periodSeconds: 10
86         livenessProbe:
87           tcpSocket:
88             port: 5432
89         initialDelaySeconds: 15
90         periodSeconds: 20
91         volumeMounts:
92         - name: pgpool-pgconf
93           mountPath: /pgconf/pgpoolconfigdir
94           readOnly: false
95       volumes:
96       - name: pgpool-pgconf
97         emptyDir: {}
98       - name: pgpool-pgconf-static
99         configMap:
100           name: {{ include "common.fullname" . }}-pgpool-configmap