80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
{{- if .Values.mongodb.enabled }}
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "oramap.fullname" . }}-mongodb
|
|
labels:
|
|
{{- include "oramap.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: database
|
|
spec:
|
|
serviceName: {{ include "oramap.fullname" . }}-mongodb
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
{{- include "oramap.selectorLabels" . | nindent 6 }}
|
|
app.kubernetes.io/component: database
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "oramap.selectorLabels" . | nindent 8 }}
|
|
app.kubernetes.io/component: database
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: mongodb
|
|
image: "{{ .Values.mongodb.image.repository }}:{{ .Values.mongodb.image.tag }}"
|
|
imagePullPolicy: {{ .Values.mongodb.image.pullPolicy }}
|
|
ports:
|
|
- name: mongodb
|
|
containerPort: 27017
|
|
protocol: TCP
|
|
env:
|
|
- name: MONGO_INITDB_DATABASE
|
|
value: {{ .Values.mongodb.database }}
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- mongo
|
|
- --eval
|
|
- "db.adminCommand('ping')"
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 6
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- mongo
|
|
- --eval
|
|
- "db.adminCommand('ping')"
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
resources:
|
|
{{- toYaml .Values.mongodb.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data/db
|
|
{{- if .Values.mongodb.persistence.enabled }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
{{- if .Values.mongodb.persistence.storageClass }}
|
|
storageClassName: {{ .Values.mongodb.persistence.storageClass }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.mongodb.persistence.size }}
|
|
{{- else }}
|
|
volumes:
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- end }}
|