Files
buildpath/helm/buildpath/templates/mongo-statefulset.yaml
T
vhaudiquet ff9d88d582
pipeline / lint-and-format (push) Successful in 4m1s
pipeline / build-and-push-images (push) Successful in 2m8s
pipeline / lint-and-publish-chart (push) Successful in 11s
helm: add helm chart
2026-07-26 16:12:17 +02:00

79 lines
2.7 KiB
YAML

{{- if .Values.mongo.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "buildpath.fullname" . }}-mongo
labels:
{{- include "buildpath.labels" . | nindent 4 }}
app.kubernetes.io/component: mongo
spec:
serviceName: {{ include "buildpath.fullname" . }}-mongo
replicas: 1
selector:
matchLabels:
{{- include "buildpath.componentSelectorLabels" (set . "component" "mongo") | nindent 6 }}
template:
metadata:
labels:
{{- include "buildpath.componentSelectorLabels" (set . "component" "mongo") | nindent 8 }}
spec:
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
runAsUser: {{ .Values.mongo.runAsUser }}
runAsGroup: {{ .Values.mongo.runAsGroup }}
fsGroup: {{ .Values.mongo.runAsGroup }}
containers:
- name: mongo
image: "{{ .Values.mongo.image.repository }}:{{ .Values.mongo.image.tag }}"
imagePullPolicy: {{ .Values.mongo.image.pullPolicy }}
args:
- mongod
- --wiredTigerCacheSizeGB
- {{ .Values.mongo.wiredTigerCacheSizeGB | quote }}
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: {{ include "buildpath.fullname" . }}
key: MONGO_USER
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "buildpath.fullname" . }}
key: MONGO_PASS
{{- if .Values.mongo.auth.initialDatabase }}
- name: MONGO_INITDB_DATABASE
value: {{ .Values.mongo.auth.initialDatabase | quote }}
{{- end }}
{{- with .Values.mongo.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: mongo
containerPort: 27017
protocol: TCP
volumeMounts:
- name: data
mountPath: /data/db
- name: config
mountPath: /data/configdb
resources:
{{- toYaml .Values.mongo.resources | nindent 12 }}
volumes:
- name: config
persistentVolumeClaim:
claimName: {{ include "buildpath.fullname" . }}-mongo-config
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- {{ .Values.mongo.dataVolume.accessMode | quote }}
storageClassName: {{ .Values.mongo.dataVolume.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.mongo.dataVolume.size | quote }}
{{- end }}