1 {{- if .Values.replicaSet.enabled }}
5 name: {{ template "mongodb.fullname" . }}-secondary
6 namespace: {{.Values.namespace }}
8 app: {{ template "mongodb.name" . }}
9 chart: {{ template "mongodb.chart" . }}
10 heritage: {{ .Release.Service }}
11 release: {{ .Release.Name }}
12 {{- with .Values.labels }}
13 {{ toYaml . | indent 4 }}
15 {{- with .Values.annotations }}
17 {{ toYaml . | indent 4 }}
22 app: {{ template "mongodb.name" . }}
23 release: {{ .Release.Name }}
25 podManagementPolicy: "Parallel"
26 serviceName: {{ template "mongodb.fullname" . }}-headless
27 replicas: {{ .Values.replicaSet.replicas.secondary }}
29 type: {{ .Values.updateStrategy.type }}
30 {{- if (eq "Recreate" .Values.updateStrategy.type) }}
36 app: {{ template "mongodb.name" . }}
37 chart: {{ template "mongodb.chart" . }}
38 release: {{ .Release.Name }}
40 {{- if .Values.podLabels }}
41 {{ toYaml .Values.podLabels | indent 8 }}
43 {{- if or .Values.podAnnotations .Values.metrics.enabled }}
45 {{- if .Values.podAnnotations }}
46 {{ toYaml .Values.podAnnotations | indent 8 }}
48 {{- if .Values.metrics.enabled }}
49 {{ toYaml .Values.metrics.podAnnotations | indent 8 }}
53 {{- if .Values.schedulerName }}
54 schedulerName: "{{ .Values.schedulerName }}"
56 {{- if .Values.priorityClassName }}
57 priorityClassName: {{ .Values.priorityClassName }}
59 {{- if .Values.securityContext.enabled }}
61 fsGroup: {{ .Values.securityContext.fsGroup }}
63 {{- if .Values.affinity }}
65 {{ toYaml .Values.affinity | indent 8 }}
67 {{- if .Values.nodeSelector }}
69 {{ toYaml .Values.nodeSelector | indent 8 }}
71 {{- if .Values.tolerations }}
73 {{ toYaml .Values.tolerations | indent 8 }}
75 {{- include "mongodb.imagePullSecrets" . | indent 6 }}
77 {{- if .Values.extraInitContainers }}
78 {{ tpl .Values.extraInitContainers . | indent 6}}
80 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
81 - name: volume-permissions
82 image: {{ template "mongodb.volumePermissions.image" . }}
83 imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
84 command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.persistence.mountPath }}"]
87 resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 }}
90 mountPath: {{ .Values.persistence.mountPath }}
93 - name: {{ template "mongodb.name" . }}-secondary
94 image: {{ template "mongodb.image" . }}
95 imagePullPolicy: {{ .Values.image.pullPolicy }}
96 {{- if .Values.securityContext.enabled }}
99 runAsUser: {{ .Values.securityContext.runAsUser }}
102 - containerPort: {{ .Values.service.port }}
105 {{- if .Values.image.debug}}
106 - name: BITNAMI_DEBUG
109 - name: MONGODB_SYSTEM_LOG_VERBOSITY
110 value: {{ .Values.mongodbSystemLogVerbosity | quote }}
111 - name: MONGODB_DISABLE_SYSTEM_LOG
112 {{- if .Values.mongodbDisableSystemLog }}
117 - name: MONGODB_POD_NAME
120 fieldPath: metadata.name
121 - name: MONGODB_REPLICA_SET_MODE
123 - name: MONGODB_PRIMARY_HOST
124 value: {{ template "mongodb.fullname" . }}
125 - name: MONGODB_REPLICA_SET_NAME
126 value: {{ .Values.replicaSet.name | quote }}
127 {{- if .Values.replicaSet.useHostnames }}
128 - name: MONGODB_ADVERTISED_HOSTNAME
129 value: "$(MONGODB_POD_NAME).{{ template "mongodb.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
131 {{- if .Values.usePassword }}
132 - name: MONGODB_PRIMARY_ROOT_PASSWORD
135 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
136 key: mongodb-root-password
137 - name: MONGODB_REPLICA_SET_KEY
140 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
141 key: mongodb-replica-set-key
143 - name: MONGODB_ENABLE_IPV6
144 {{- if .Values.mongodbEnableIPv6 }}
149 - name: MONGODB_ENABLE_DIRECTORY_PER_DB
150 {{- if .Values.mongodbDirectoryPerDB }}
155 {{- if .Values.mongodbExtraFlags }}
156 - name: MONGODB_EXTRA_FLAGS
157 value: {{ .Values.mongodbExtraFlags | join " " | quote }}
159 {{- if .Values.extraEnvVars }}
160 {{- include "mongodb.tplValue" ( dict "value" .Values.extraEnvVars "context" $ ) | nindent 10 }}
162 {{- if .Values.livenessProbe.enabled }}
168 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
169 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
170 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
171 successThreshold: {{ .Values.livenessProbe.successThreshold }}
172 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
174 {{- if .Values.readinessProbe.enabled }}
180 - "db.adminCommand('ping')"
181 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
182 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
183 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
184 successThreshold: {{ .Values.readinessProbe.successThreshold }}
185 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
189 mountPath: {{ .Values.persistence.mountPath }}
190 subPath: {{ .Values.persistence.subPath }}
191 {{- if .Values.configmap }}
193 mountPath: /opt/bitnami/mongodb/conf/mongodb.conf
194 subPath: mongodb.conf
196 {{- if .Values.extraVolumeMounts }}
197 {{ toYaml .Values.extraVolumeMounts | indent 12}}
200 {{ toYaml .Values.resources | indent 12 }}
201 {{- if .Values.metrics.enabled }}
203 image: {{ template "mongodb.metrics.image" . }}
204 imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
205 {{- if .Values.securityContext.enabled }}
208 runAsUser: {{ .Values.securityContext.runAsUser }}
211 {{- if .Values.usePassword }}
212 - name: MONGODB_ROOT_PASSWORD
215 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
216 key: mongodb-root-password
217 command: [ 'sh', '-c', '/bin/mongodb_exporter --mongodb.uri mongodb://root:${MONGODB_ROOT_PASSWORD}@localhost:{{ .Values.service.port }}/admin {{ .Values.metrics.extraArgs }}' ]
219 command: [ 'sh', '-c', '/bin/mongodb_exporter --mongodb.uri mongodb://localhost:{{ .Values.service.port }} {{ .Values.metrics.extraArgs }}' ]
224 {{- if .Values.metrics.livenessProbe.enabled }}
229 initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
230 periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
231 timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
232 failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
233 successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
235 {{- if .Values.metrics.readinessProbe.enabled }}
240 initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
241 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
242 timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
243 failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
244 successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
247 {{ toYaml .Values.metrics.resources | indent 12 }}
249 {{- if .Values.sidecars }}
250 {{ toYaml .Values.sidecars | indent 8 }}
253 {{- if .Values.configmap }}
256 name: {{ template "mongodb.fullname" . }}
258 {{- if .Values.extraVolumes }}
259 {{ toYaml .Values.extraVolumes | indent 8}}
261 {{- if .Values.persistence.enabled }}
262 volumeClaimTemplates:
266 {{- range $key, $value := .Values.persistence.annotations }}
267 {{ $key }}: "{{ $value }}"
271 {{- range .Values.persistence.accessModes }}
276 storage: {{ .Values.persistence.size | quote }}
277 {{ include "mongodb.storageClass" . }}