1 {{- if not .Values.replicaSet.enabled }}
3 kind: {{ if .Values.useStatefulSet }}{{ "StatefulSet" }}{{- else }}{{ "Deployment" }}{{- end }}
5 name: {{ template "mongodb.fullname" . }}
6 namespace: {{.Values.namespace }}
8 app: {{ template "mongodb.name" . }}
9 chart: {{ template "mongodb.chart" . }}
10 release: "{{ .Release.Name }}"
11 heritage: "{{ .Release.Service }}"
12 {{- with .Values.labels }}
13 {{ toYaml . | indent 4 }}
15 {{- with .Values.annotations }}
17 {{ toYaml . | indent 4 }}
20 {{- if .Values.useStatefulSet }}
21 serviceName: {{ template "mongodb.serviceName" . }}
26 type: {{ .Values.updateStrategy.type }}
27 {{- if (eq "Recreate" .Values.updateStrategy.type) }}
32 app: {{ template "mongodb.name" . }}
33 release: "{{ .Release.Name }}"
37 app: {{ template "mongodb.name" . }}
38 release: "{{ .Release.Name }}"
39 chart: {{ template "mongodb.chart" . }}
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.fullname" . }}
94 image: {{ template "mongodb.image" . }}
95 imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
96 {{- if .Values.securityContext.enabled }}
99 runAsUser: {{ .Values.securityContext.runAsUser }}
102 {{- if .Values.image.debug}}
103 - name: BITNAMI_DEBUG
106 {{- if .Values.usePassword }}
107 {{- if and .Values.mongodbUsername .Values.mongodbDatabase }}
108 - name: MONGODB_PASSWORD
111 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
112 key: mongodb-password
114 - name: MONGODB_ROOT_PASSWORD
117 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
118 key: mongodb-root-password
120 {{- if .Values.mongodbUsername }}
121 - name: MONGODB_USERNAME
122 value: {{ .Values.mongodbUsername | quote }}
124 - name: MONGODB_SYSTEM_LOG_VERBOSITY
125 value: {{ .Values.mongodbSystemLogVerbosity | quote }}
126 - name: MONGODB_DISABLE_SYSTEM_LOG
127 {{- if .Values.mongodbDisableSystemLog }}
132 {{- if .Values.mongodbDatabase }}
133 - name: MONGODB_DATABASE
134 value: {{ .Values.mongodbDatabase | quote }}
136 - name: MONGODB_ENABLE_IPV6
137 {{- if .Values.mongodbEnableIPv6 }}
142 - name: MONGODB_ENABLE_DIRECTORY_PER_DB
143 {{- if .Values.mongodbDirectoryPerDB }}
148 {{- if .Values.mongodbExtraFlags }}
149 - name: MONGODB_EXTRA_FLAGS
150 value: {{ .Values.mongodbExtraFlags | join " " | quote }}
152 {{- if .Values.extraEnvVars }}
153 {{- include "mongodb.tplValue" ( dict "value" .Values.extraEnvVars "context" $ ) | nindent 8 }}
158 {{- if .Values.livenessProbe.enabled }}
164 - "db.adminCommand('ping')"
165 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
166 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
167 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
168 successThreshold: {{ .Values.livenessProbe.successThreshold }}
169 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
171 {{- if .Values.readinessProbe.enabled }}
177 - "db.adminCommand('ping')"
178 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
179 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
180 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
181 successThreshold: {{ .Values.readinessProbe.successThreshold }}
182 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
186 mountPath: {{ .Values.persistence.mountPath }}
187 subPath: {{ .Values.persistence.subPath }}
188 {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|js|json]") (.Values.initConfigMap) }}
189 - name: custom-init-scripts
190 mountPath: /docker-entrypoint-initdb.d
192 {{- if .Values.configmap }}
194 mountPath: /opt/bitnami/mongodb/conf/mongodb.conf
195 subPath: mongodb.conf
197 {{- if .Values.extraVolumeMounts }}
198 {{ toYaml .Values.extraVolumeMounts | indent 8}}
201 {{ toYaml .Values.resources | indent 10 }}
202 {{- if .Values.metrics.enabled }}
204 image: {{ template "mongodb.metrics.image" . }}
205 imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
206 {{- if .Values.securityContext.enabled }}
209 runAsUser: {{ .Values.securityContext.runAsUser }}
212 {{- if .Values.usePassword }}
213 - name: MONGODB_ROOT_PASSWORD
216 name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
217 key: mongodb-root-password
218 command: [ 'sh', '-c', '/bin/mongodb_exporter --mongodb.uri mongodb://root:${MONGODB_ROOT_PASSWORD}@localhost:{{ .Values.service.port }}/admin {{ .Values.metrics.extraArgs }}' ]
220 command: [ 'sh', '-c', '/bin/mongodb_exporter --mongodb.uri mongodb://localhost:{{ .Values.service.port }} {{ .Values.metrics.extraArgs }}' ]
225 {{- if .Values.metrics.livenessProbe.enabled }}
230 initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
231 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
232 timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
233 failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
234 successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
236 {{- if .Values.metrics.readinessProbe.enabled }}
241 initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
242 periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
243 timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
244 failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
245 successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
248 {{ toYaml .Values.metrics.resources | indent 10 }}
250 {{- if .Values.sidecars }}
251 {{ toYaml .Values.sidecars | indent 6 }}
254 {{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|js|json]") }}
255 - name: custom-init-scripts
257 name: {{ template "mongodb.fullname" . }}-init-scripts
259 {{- if (.Values.initConfigMap) }}
260 - name: custom-init-scripts
262 name: {{ .Values.initConfigMap.name }}
265 {{- if not .Values.useStatefulSet }}
266 {{- if .Values.persistence.enabled }}
267 persistentVolumeClaim:
268 claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }}
274 {{- if .Values.configmap }}
277 name: {{ template "mongodb.fullname" . }}
279 {{- if .Values.extraVolumes }}
280 {{ toYaml .Values.extraVolumes | indent 6}}
282 {{- if .Values.useStatefulSet }}
283 {{- if .Values.persistence.enabled }}
284 volumeClaimTemplates:
288 {{- range $key, $value := .Values.persistence.annotations }}
289 {{ $key }}: "{{ $value }}"
293 {{- range .Values.persistence.accessModes }}
298 storage: {{ .Values.persistence.size | quote }}
299 {{ include "mongodb.storageClass" . }}