|
| 1 | +{{ if and (eq .Values.type "documentdb") .Values.ferretdb.enabled }} |
| 2 | +{{- $dbOwner := .Values.cluster.initdb.owner | default .Values.cluster.initdb.database | default "app" }} |
| 3 | +{{- $dbName := .Values.cluster.initdb.database | default "app" }} |
| 4 | +--- |
| 5 | +apiVersion: apps/v1 |
| 6 | +kind: Deployment |
| 7 | +metadata: |
| 8 | + name: {{ include "cluster.fullname" . }}-ferretdb |
| 9 | + namespace: {{ include "cluster.namespace" . }} |
| 10 | + labels: |
| 11 | + {{- include "cluster.labels" . | nindent 4 }} |
| 12 | + app.kubernetes.io/component: ferretdb |
| 13 | +spec: |
| 14 | + replicas: {{ .Values.ferretdb.instances }} |
| 15 | + selector: |
| 16 | + matchLabels: |
| 17 | + {{- include "cluster.selectorLabels" . | nindent 6 }} |
| 18 | + app.kubernetes.io/component: ferretdb |
| 19 | + template: |
| 20 | + metadata: |
| 21 | + labels: |
| 22 | + {{- include "cluster.selectorLabels" . | nindent 8 }} |
| 23 | + app.kubernetes.io/component: ferretdb |
| 24 | + spec: |
| 25 | + containers: |
| 26 | + - name: ferretdb |
| 27 | + image: {{ .Values.ferretdb.image | default "ghcr.io/ferretdb/ferretdb" }}:{{ .Values.ferretdb.tag | default .Values.version.ferretdb }} |
| 28 | + imagePullPolicy: {{ .Values.cluster.imagePullPolicy }} |
| 29 | + ports: |
| 30 | + - name: mongodb |
| 31 | + containerPort: 27017 |
| 32 | + protocol: TCP |
| 33 | + command: ["/ferretdb"] |
| 34 | + args: |
| 35 | + - "--listen-addr=:27017" |
| 36 | + - "--postgresql-url=postgres://{{ $dbOwner }}@{{ include "cluster.fullname" . }}-rw:5432/{{ $dbName }}" |
| 37 | + - "--telemetry=disable" |
| 38 | + - "--log-level=info" |
| 39 | + env: |
| 40 | + {{- if .Values.cluster.initdb.secret }} |
| 41 | + - name: PGPASSWORD |
| 42 | + valueFrom: |
| 43 | + secretKeyRef: |
| 44 | + name: {{ .Values.cluster.initdb.secret.name }} |
| 45 | + key: password |
| 46 | + {{- else }} |
| 47 | + - name: PGPASSWORD |
| 48 | + valueFrom: |
| 49 | + secretKeyRef: |
| 50 | + name: {{ include "cluster.fullname" . }}-app |
| 51 | + key: password |
| 52 | + {{- end }} |
| 53 | + {{- with .Values.ferretdb.env }} |
| 54 | + {{- toYaml . | nindent 8 }} |
| 55 | + {{- end }} |
| 56 | + {{- with .Values.ferretdb.resources }} |
| 57 | + resources: |
| 58 | + {{- toYaml . | nindent 10 }} |
| 59 | + {{- end }} |
| 60 | + livenessProbe: |
| 61 | + tcpSocket: |
| 62 | + port: 27017 |
| 63 | + initialDelaySeconds: 10 |
| 64 | + periodSeconds: 10 |
| 65 | + readinessProbe: |
| 66 | + tcpSocket: |
| 67 | + port: 27017 |
| 68 | + initialDelaySeconds: 5 |
| 69 | + periodSeconds: 5 |
| 70 | +--- |
| 71 | +apiVersion: v1 |
| 72 | +kind: Service |
| 73 | +metadata: |
| 74 | + name: {{ include "cluster.fullname" . }}-ferretdb |
| 75 | + namespace: {{ include "cluster.namespace" . }} |
| 76 | + labels: |
| 77 | + {{- include "cluster.labels" . | nindent 4 }} |
| 78 | + app.kubernetes.io/component: ferretdb |
| 79 | +spec: |
| 80 | + type: ClusterIP |
| 81 | + ports: |
| 82 | + - name: mongodb |
| 83 | + port: 27017 |
| 84 | + targetPort: 27017 |
| 85 | + protocol: TCP |
| 86 | + selector: |
| 87 | + {{- include "cluster.selectorLabels" . | nindent 4 }} |
| 88 | + app.kubernetes.io/component: ferretdb |
| 89 | +{{- end }} |
0 commit comments