1 {{- if .Values.replication.enabled }}
2 apiVersion: apps/v1beta2
5 name: "{{ template "postgresql.fullname" . }}-slave"
7 app: {{ template "postgresql.name" . }}
8 chart: {{ template "postgresql.chart" . }}
9 release: {{ .Release.Name | quote }}
10 heritage: {{ .Release.Service | quote }}
12 serviceName: {{ template "postgresql.fullname" . }}-headless
13 replicas: {{ .Values.replication.slaveReplicas }}
16 app: {{ template "postgresql.name" . }}
17 release: {{ .Release.Name | quote }}
21 name: {{ template "postgresql.fullname" . }}
23 app: {{ template "postgresql.name" . }}
24 chart: {{ template "postgresql.chart" . }}
25 release: {{ .Release.Name | quote }}
26 heritage: {{ .Release.Service | quote }}
29 {{- if .Values.securityContext.enabled }}
31 fsGroup: {{ .Values.securityContext.fsGroup }}
32 runAsUser: {{ .Values.securityContext.runAsUser }}
34 {{- if .Values.image.pullSecrets }}
36 {{- range .Values.image.pullSecrets }}
40 {{- if .Values.slave.nodeSelector }}
42 {{ toYaml .Values.slave.nodeSelector | indent 8 }}
44 {{- if .Values.slave.affinity }}
46 {{ toYaml .Values.slave.affinity | indent 8 }}
48 {{- if .Values.slave.tolerations }}
50 {{ toYaml .Values.slave.tolerations | indent 8 }}
52 {{- if .Values.terminationGracePeriodSeconds }}
53 terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
55 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
57 - name: init-chmod-data
58 image: {{ template "postgresql.volumePermissions.image" . }}
59 imagePullPolicy: "{{ .Values.volumePermissions.image.pullPolicy }}"
61 {{ toYaml .Values.resources | indent 10 }}
66 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /bitnami
67 if [ -d /bitnami/postgresql/data ]; then
68 chmod 0700 /bitnami/postgresql/data;
71 runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
74 mountPath: /bitnami/postgresql
77 - name: {{ template "postgresql.fullname" . }}
78 image: {{ template "postgresql.image" . }}
79 imagePullPolicy: "{{ .Values.image.pullPolicy }}"
81 {{ toYaml .Values.resources | indent 10 }}
83 {{- if .Values.image.debug}}
89 - name: POSTGRESQL_REPLICATION_MODE
91 - name: POSTGRESQL_REPLICATION_USER
92 value: {{ .Values.replication.user | quote }}
93 {{- if .Values.usePasswordFile }}
94 - name: POSTGRESQL_REPLICATION_PASSWORD_FILE
95 value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
97 - name: POSTGRESQL_REPLICATION_PASSWORD
100 name: {{ template "postgresql.secretName" . }}
101 key: postgresql-replication-password
103 - name: POSTGRESQL_CLUSTER_APP_NAME
104 value: {{ .Values.replication.applicationName }}
105 - name: POSTGRESQL_MASTER_HOST
106 value: {{ template "postgresql.fullname" . }}
107 - name: POSTGRESQL_MASTER_PORT_NUMBER
108 value: {{ .Values.service.port | quote }}
111 containerPort: {{ .Values.service.port }}
112 {{- if .Values.livenessProbe.enabled }}
118 {{- if .Values.postgresqlDatabase }}
119 - exec pg_isready -U {{ .Values.postgresqlUsername | quote }} -d {{ .Values.postgresqlDatabase | quote }} -h localhost
121 - exec pg_isready -U {{ .Values.postgresqlUsername | quote }} -h localhost
123 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
124 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
125 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
126 successThreshold: {{ .Values.livenessProbe.successThreshold }}
127 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
129 {{- if .Values.readinessProbe.enabled }}
135 {{- if .Values.postgresqlDatabase }}
136 - exec pg_isready -U {{ .Values.postgresqlUsername | quote }} -d {{ .Values.postgresqlDatabase | quote }} -h localhost
138 - exec pg_isready -U {{ .Values.postgresqlUsername | quote }} -h localhost
140 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
141 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
142 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
143 successThreshold: {{ .Values.readinessProbe.successThreshold }}
144 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
147 {{- if .Values.usePasswordFile }}
148 - name: postgresql-password
149 mountPath: /opt/bitnami/postgresql/secrets
151 {{- if .Values.persistence.enabled }}
153 mountPath: {{ .Values.persistence.mountPath }}
155 {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }}
156 - name: postgresql-extended-config
157 mountPath: /bitnami/postgresql/conf/conf.d/
159 {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
160 - name: postgresql-config
161 mountPath: /bitnami/postgresql/conf
164 {{- if .Values.usePasswordFile }}
165 - name: postgresql-password
167 secretName: {{ template "postgresql.secretName" . }}
169 {{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}}
170 - name: postgresql-config
172 name: {{ template "postgresql.configurationCM" . }}
174 {{- if or (.Files.Glob "files/conf.d/*.conf") .Values.extendedConfConfigMap }}
175 - name: postgresql-extended-config
177 name: {{ template "postgresql.extendedConfigurationCM" . }}
179 {{- if not .Values.persistence.enabled }}
184 type: {{ .Values.updateStrategy.type }}
185 {{- if .Values.persistence.enabled }}
186 volumeClaimTemplates:
189 {{- with .Values.persistence.annotations }}
191 {{- range $key, $value := . }}
192 {{ $key }}: {{ $value }}
197 {{- range .Values.persistence.accessModes }}
202 storage: {{ .Values.persistence.size | quote }}
203 {{- if .Values.persistence.storageClass }}
204 {{- if (eq "-" .Values.persistence.storageClass) }}
207 storageClassName: "{{ .Values.persistence.storageClass }}"