2 # Copyright © 2019 Samsung Electronics
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 UID of postgres root password
19 {{- define "common.postgres.secret.rootPassUID" -}}
20 {{- printf "db-root-password" }}
24 Name of postgres secret
26 {{- define "common.postgres.secret._secretName" -}}
27 {{- $global := .dot }}
28 {{- $chartName := tpl .chartName $global -}}
29 {{- include "common.secret.genName" (dict "global" $global "uid" (include .uidTemplate $global) "chartName" $chartName) }}
33 Name of postgres root password secret
35 {{- define "common.postgres.secret.rootPassSecretName" -}}
36 {{- include "common.postgres.secret._secretName" (set . "uidTemplate" "common.postgres.secret.rootPassUID") }}
40 UID of postgres user credentials
42 {{- define "common.postgres.secret.userCredentialsUID" -}}
43 {{- printf "db-user-credentials" }}
47 Name of postgres user credentials secret
49 {{- define "common.postgres.secret.userCredentialsSecretName" -}}
50 {{- include "common.postgres.secret._secretName" (set . "uidTemplate" "common.postgres.secret.userCredentialsUID") }}
54 UID of postgres primary password
56 {{- define "common.postgres.secret.primaryPasswordUID" -}}
57 {{- printf "primary-password" }}
61 Name of postgres user credentials secret
63 {{- define "common.postgres.secret.primaryPasswordSecretName" -}}
64 {{- include "common.postgres.secret._secretName" (set . "uidTemplate" "common.postgres.secret.primaryPasswordUID") }}
68 Create postgres cluster via postgres crunchydata-operator
70 {{- define "common.postgresOpInstance" -}}
71 {{- $dot := default . .dot -}}
72 {{- $global := $dot.Values.global -}}
73 {{- $dbinst := include "common.name" $dot -}}
75 apiVersion: postgres-operator.crunchydata.com/v1beta1
87 {{- if .Values.postgresOperator.imagePostgres }}
88 image: {{ .Values.postgresOperator.imagePostgres | quote }}
91 - name: {{ include "common.namespace" . }}-docker-registry-key
92 postgresVersion: {{ $dot.Values.postgresOperator.postgresVersion }}
94 - name: {{ default "instance1" .Values.postgresOperator.instanceName | quote }}
95 replicas: {{ default 2 .Values.postgresOperator.instanceReplicas }}
97 {{- if .Values.instanceStorageClassName }}
98 storageClassName: {{ .Values.postgresOperator.instanceStorageClassName | quote }}
104 storage: {{ default "1Gi" .Values.postgresOperator.instanceSize | quote }}
105 {{- if or .Values.instanceMemory .Values.postgresOperator.instanceCPU }}
108 cpu: {{ default "" .Values.postgresOperator.instanceCPU | quote }}
109 memory: {{ default "" .Values.postgresOperator.instanceMemory | quote }}
113 preferredDuringSchedulingIgnoredDuringExecution:
116 topologyKey: kubernetes.io/hostname
119 postgres-operator.crunchydata.com/cluster: {{ $dbinst }}
120 postgres-operator.crunchydata.com/instance-set: {{ default "instance1" .Values.postgresOperator.instanceName | quote }}
127 {{- if .Values.postgresOperator.imagePgBouncer }}
128 image: {{ .Values.postgresOperator.imagePgBouncer | quote }}
130 replicas: {{ default 2 .Values.postgresOperator.bouncerReplicas }}
133 preferredDuringSchedulingIgnoredDuringExecution:
136 topologyKey: kubernetes.io/hostname
139 postgres-operator.crunchydata.com/cluster: {{ $dbinst }}
140 postgres-operator.crunchydata.com/role: pgbouncer
141 {{- if .Values.postgresOperator.monitoring }}
145 image: {{ default "" .Values.postgresOperator.imageExporter | quote }}
146 {{- if .Values.postgresOperator.monitoringConfig }}
147 {{ toYaml .Values.monitoringConfig | indent 8 }}