2 # ============LICENSE_START=======================================================
3 # Copyright (c) 2021 Bell Canada.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
23 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
25 replicas: {{ .Values.replicaCount }}
26 selector: {{- include "common.selectors" . | nindent 4 }}
27 serviceName: {{ include "common.servicename" . }}
29 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
31 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
33 {{- toYaml .Values.podSecurityContext | nindent 8 }}
35 - name: {{ include "common.name" . }}
36 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
38 {{- toYaml .Values.securityContext | nindent 12 }}
39 imagePullPolicy: {{ .Values.pullPolicy }}
40 ports: {{ include "common.containerPorts" . | nindent 12 }}
43 command: ["psql", "-w", "-U", "{{ .Values.config.pgRootUserName }}", "-c", "select 1"]
44 initialDelaySeconds: 5
48 command: ["psql", "-w", "-U", "{{ .Values.config.pgRootUserName }}", "-c", "select 1"]
49 initialDelaySeconds: 5
53 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "login") | indent 14 }}
55 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "password") | indent 14 }}
57 value: {{ .Values.config.pgDatabase }}
59 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-creds" "key" "login") | indent 14 }}
60 - name: POSTGRES_PASSWORD
61 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-creds" "key" "password") | indent 14 }}
63 value: /var/lib/postgresql/data/pgdata
65 {{ include "common.resources" . | indent 12 }}
67 - name: {{ include "common.fullname" . }}-init
68 mountPath: /docker-entrypoint-initdb.d
69 - name: {{ include "common.fullname" . }}
70 mountPath: /var/lib/postgresql/data
72 - name: {{ include "common.fullname" . }}-init
74 name: {{ include "common.fullname" . }}-init
75 {{- with .Values.nodeSelector }}
77 {{- toYaml . | nindent 8 }}
79 {{- with .Values.affinity }}
81 {{- toYaml . | nindent 8 }}
83 {{- with .Values.tolerations }}
85 {{- toYaml . | nindent 8 }}
87 {{if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
89 - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }}