{{- if .Values.pgbouncer.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "label-studio.fullname" . }}-pgbouncer labels: app.kubernetes.io/name: {{ include "label-studio.name" .}}-pgbouncer helm.sh/chart: {{ include "label-studio.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: replicas: {{ .Values.pgbouncer.replicaCount }} selector: matchLabels: app.kubernetes.io/name: {{ include "label-studio.name" . }}-pgbouncer app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: app.kubernetes.io/name: {{ include "label-studio.name" . }}-pgbouncer app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: pgbouncer {{- if .Values.global.imageRegistry }} image: "{{ .Values.global.imageRegistry | trimSuffix "/" }}/{{ .Values.pgbouncer.image.repository }}:{{ .Values.pgbouncer.image.tag }}" {{- else }} image: "{{ .Values.pgbouncer.image.repository }}:{{ .Values.pgbouncer.image.tag }}" {{- end }} imagePullPolicy: {{ .Values.pgbouncer.image.pullPolicy }} ports: - name: pgbouncer containerPort: 5432 protocol: TCP env: - name: DB_HOST value: {{ .Values.env.POSTGRE_HOST | quote }} - name: DB_PORT value: {{ .Values.env.POSTGRE_PORT | quote }} - name: DB_NAME value: {{ .Values.env.POSTGRE_NAME | quote }} - name: DB_USER value: {{ .Values.env.POSTGRE_USER | quote }} - name: DB_PASSWORD {{- if .Values.existingSecret }} valueFrom: secretKeyRef: name: {{ .Values.existingSecret | quote }} key: POSTGRE_PASSWORD {{- else }} value: {{ .Values.env.POSTGRE_PASSWORD | quote }} {{- end }} - name: POOL_MODE value: {{ .Values.pgbouncer.poolMode | quote }} - name: MAX_CLIENT_CONN value: {{ .Values.pgbouncer.maxClientConn | quote }} - name: DEFAULT_POOL_SIZE value: {{ .Values.pgbouncer.defaultPoolSize | quote }} - name: MAX_DB_CONNECTIONS value: {{ .Values.pgbouncer.maxDbConnections | quote }} - name: AUTH_TYPE value: {{ .Values.pgbouncer.authType | quote }} livenessProbe: tcpSocket: port: 5432 initialDelaySeconds: 15 periodSeconds: 20 readinessProbe: tcpSocket: port: 5432 initialDelaySeconds: 5 periodSeconds: 10 resources: {{- toYaml .Values.pgbouncer.resources | nindent 12 }} {{- with .Values.pgbouncer.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.pgbouncer.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.pgbouncer.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}