|
| 1 | +{{- if .Values.mongodb.enabled }} |
| 2 | +apiVersion: apps/v1 |
| 3 | +kind: Deployment |
| 4 | +metadata: |
| 5 | + name: {{ include "eagle-api.mongodb.fullname" . }} |
| 6 | + labels: |
| 7 | + {{- include "eagle-api.mongodb.labels" . | nindent 4 }} |
| 8 | + annotations: |
| 9 | + description: "MongoDB database for eagle-api" |
| 10 | +spec: |
| 11 | + replicas: 1 |
| 12 | + strategy: |
| 13 | + type: Recreate # Critical: MongoDB is stateful with single replica |
| 14 | + selector: |
| 15 | + matchLabels: |
| 16 | + {{- include "eagle-api.mongodb.selectorLabels" . | nindent 6 }} |
| 17 | + template: |
| 18 | + metadata: |
| 19 | + labels: |
| 20 | + {{- include "eagle-api.mongodb.selectorLabels" . | nindent 8 }} |
| 21 | + spec: |
| 22 | + containers: |
| 23 | + - name: mongodb |
| 24 | + image: "{{ .Values.mongodb.image.repository }}:{{ .Values.mongodb.image.tag }}" |
| 25 | + imagePullPolicy: {{ .Values.mongodb.image.pullPolicy }} |
| 26 | + ports: |
| 27 | + - containerPort: 27017 |
| 28 | + protocol: TCP |
| 29 | + name: mongodb |
| 30 | + env: |
| 31 | + - name: MONGODB_USER |
| 32 | + valueFrom: |
| 33 | + secretKeyRef: |
| 34 | + name: {{ .Values.mongodb.existingSecret }} |
| 35 | + key: {{ .Values.mongodb.secretKeys.user }} |
| 36 | + - name: MONGODB_PASSWORD |
| 37 | + valueFrom: |
| 38 | + secretKeyRef: |
| 39 | + name: {{ .Values.mongodb.existingSecret }} |
| 40 | + key: {{ .Values.mongodb.secretKeys.password }} |
| 41 | + - name: MONGODB_DATABASE |
| 42 | + valueFrom: |
| 43 | + secretKeyRef: |
| 44 | + name: {{ .Values.mongodb.existingSecret }} |
| 45 | + key: {{ .Values.mongodb.secretKeys.database }} |
| 46 | + - name: MONGODB_ADMIN_PASSWORD |
| 47 | + valueFrom: |
| 48 | + secretKeyRef: |
| 49 | + name: {{ .Values.mongodb.existingSecret }} |
| 50 | + key: {{ .Values.mongodb.secretKeys.adminPassword }} |
| 51 | + volumeMounts: |
| 52 | + - name: mongodb-data |
| 53 | + mountPath: /var/lib/mongodb/data |
| 54 | + resources: |
| 55 | + {{- toYaml .Values.mongodb.resources | nindent 10 }} |
| 56 | + livenessProbe: |
| 57 | + tcpSocket: |
| 58 | + port: 27017 |
| 59 | + initialDelaySeconds: {{ .Values.mongodb.probes.liveness.initialDelaySeconds }} |
| 60 | + periodSeconds: {{ .Values.mongodb.probes.liveness.periodSeconds }} |
| 61 | + timeoutSeconds: {{ .Values.mongodb.probes.liveness.timeoutSeconds }} |
| 62 | + failureThreshold: {{ .Values.mongodb.probes.liveness.failureThreshold }} |
| 63 | + readinessProbe: |
| 64 | + tcpSocket: |
| 65 | + port: 27017 |
| 66 | + initialDelaySeconds: {{ .Values.mongodb.probes.readiness.initialDelaySeconds }} |
| 67 | + periodSeconds: {{ .Values.mongodb.probes.readiness.periodSeconds }} |
| 68 | + timeoutSeconds: {{ .Values.mongodb.probes.readiness.timeoutSeconds }} |
| 69 | + failureThreshold: {{ .Values.mongodb.probes.readiness.failureThreshold }} |
| 70 | + volumes: |
| 71 | + - name: mongodb-data |
| 72 | + persistentVolumeClaim: |
| 73 | + claimName: {{ .Values.mongodb.persistence.existingClaim }} |
| 74 | +{{- end }} |
0 commit comments