75 lines
2.6 KiB
YAML
75 lines
2.6 KiB
YAML
{{- if .Values.mongodb.enabled }}
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "notely.mongodb.fullname" . }}
|
|
labels:
|
|
{{- include "notely.labels" . | nindent 4 }}
|
|
spec:
|
|
serviceName: {{ include "notely.mongodb.fullname" . }}
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ include "notely.name" . }}-mongodb
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "notely.name" . }}-mongodb
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
spec:
|
|
containers:
|
|
- name: mongodb
|
|
image: "{{ .Values.mongodb.image.repository }}:{{ .Values.mongodb.image.tag }}"
|
|
imagePullPolicy: {{ .Values.mongodb.image.pullPolicy }}
|
|
ports:
|
|
- containerPort: 27017
|
|
name: mongodb
|
|
env:
|
|
- name: MONGO_INITDB_ROOT_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "notely.mongodb.fullname" . }}-credentials
|
|
key: username
|
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "notely.mongodb.fullname" . }}-credentials
|
|
key: password
|
|
- name: MONGO_INITDB_DATABASE
|
|
value: {{ .Values.mongodb.auth.database | quote }}
|
|
volumeMounts:
|
|
- name: mongodb-storage
|
|
mountPath: /data/db
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- mongosh "mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@localhost:27017/admin?authSource=admin" --quiet --eval "db.adminCommand('ping').ok"
|
|
initialDelaySeconds: 30
|
|
timeoutSeconds: 5
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- mongosh "mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@localhost:27017/admin?authSource=admin" --quiet --eval "db.adminCommand('ping').ok"
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 5
|
|
periodSeconds: 5
|
|
resources:
|
|
{{- toYaml .Values.mongodb.resources | nindent 12 }}
|
|
{{- if .Values.mongodb.persistence.enabled }}
|
|
volumes:
|
|
- name: mongodb-storage
|
|
persistentVolumeClaim:
|
|
claimName: {{ include "notely.mongodb.fullname" . }}-pvc
|
|
{{- else }}
|
|
volumes:
|
|
- name: mongodb-storage
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- end }}
|