first commit

This commit is contained in:
domrichardson
2026-03-30 11:27:28 +01:00
commit 18c5933307
19 changed files with 667 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
{{- 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 }}