puthuparambil.aditya | f71e365 | 2021-08-18 13:57:24 +0100 | [diff] [blame] | 1 | {{/* |
| 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 |
| 8 | |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 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. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | */}} |
| 20 | |
| 21 | apiVersion: apps/v1 |
| 22 | kind: StatefulSet |
| 23 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 24 | spec: |
| 25 | replicas: {{ .Values.replicaCount }} |
| 26 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 27 | serviceName: {{ include "common.servicename" . }} |
| 28 | template: |
| 29 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 30 | spec: |
| 31 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }} |
Renu Kumari | bc6eede | 2021-10-08 13:03:10 -0400 | [diff] [blame] | 32 | {{ include "common.podSecurityContext" . | indent 10 | trim}} |
puthuparambil.aditya | f71e365 | 2021-08-18 13:57:24 +0100 | [diff] [blame] | 33 | containers: |
| 34 | - name: {{ include "common.name" . }} |
| 35 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }} |
puthuparambil.aditya | f71e365 | 2021-08-18 13:57:24 +0100 | [diff] [blame] | 36 | imagePullPolicy: {{ .Values.pullPolicy }} |
| 37 | ports: {{ include "common.containerPorts" . | nindent 12 }} |
| 38 | livenessProbe: |
| 39 | exec: |
| 40 | command: ["psql", "-w", "-U", "{{ .Values.config.pgRootUserName }}", "-c", "select 1"] |
| 41 | initialDelaySeconds: 5 |
| 42 | periodSeconds: 60 |
| 43 | readinessProbe: |
| 44 | exec: |
| 45 | command: ["psql", "-w", "-U", "{{ .Values.config.pgRootUserName }}", "-c", "select 1"] |
| 46 | initialDelaySeconds: 5 |
| 47 | periodSeconds: 30 |
| 48 | env: |
| 49 | - name: DB_USERNAME |
| 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "login") | indent 14 }} |
| 51 | - name: DB_PASSWORD |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "password") | indent 14 }} |
| 53 | - name: POSTGRES_DB |
| 54 | value: {{ .Values.config.pgDatabase }} |
| 55 | - name: POSTGRES_USER |
| 56 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-creds" "key" "login") | indent 14 }} |
| 57 | - name: POSTGRES_PASSWORD |
| 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-creds" "key" "password") | indent 14 }} |
| 59 | - name: PGDATA |
| 60 | value: /var/lib/postgresql/data/pgdata |
| 61 | resources: |
| 62 | {{ include "common.resources" . | indent 12 }} |
| 63 | volumeMounts: |
| 64 | - name: {{ include "common.fullname" . }}-init |
| 65 | mountPath: /docker-entrypoint-initdb.d |
| 66 | - name: {{ include "common.fullname" . }} |
| 67 | mountPath: /var/lib/postgresql/data |
| 68 | volumes: |
| 69 | - name: {{ include "common.fullname" . }}-init |
| 70 | configMap: |
| 71 | name: {{ include "common.fullname" . }}-init |
| 72 | {{- with .Values.nodeSelector }} |
| 73 | nodeSelector: |
| 74 | {{- toYaml . | nindent 8 }} |
| 75 | {{- end }} |
| 76 | {{- with .Values.affinity }} |
| 77 | affinity: |
| 78 | {{- toYaml . | nindent 8 }} |
| 79 | {{- end }} |
| 80 | {{- with .Values.tolerations }} |
| 81 | tolerations: |
| 82 | {{- toYaml . | nindent 8 }} |
| 83 | {{- end }} |
| 84 | {{if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} |
| 85 | volumeClaimTemplates: |
| 86 | - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }} |
| 87 | {{- end }} |