2023-09-26 00:12:53 +02:00
|
|
|
{{- if .Values.job.enabled }}
|
|
|
|
---
|
|
|
|
apiVersion: "batch/v1"
|
|
|
|
kind: "Job"
|
|
|
|
metadata:
|
|
|
|
name: "{{ include "postgresql.fullname" . }}-bootstrap"
|
|
|
|
labels:
|
|
|
|
{{- include "postgresql.labels" . | nindent 4 }}
|
2023-12-02 00:58:06 +01:00
|
|
|
{{- with .Values.job.annotations }}
|
2023-09-26 00:12:53 +02:00
|
|
|
annotations:
|
2023-12-02 00:58:06 +01:00
|
|
|
{{- toYaml . | nindent 4 }}
|
|
|
|
{{- end }}
|
2023-09-26 00:12:53 +02:00
|
|
|
spec:
|
|
|
|
backoffLimit: 4
|
|
|
|
template:
|
|
|
|
metadata:
|
2023-12-02 00:58:06 +01:00
|
|
|
annotations:
|
|
|
|
confighash-users: {{ toYaml .Values.job.users | sha256sum | trunc 32 }}
|
|
|
|
confighash-databases: {{ toYaml .Values.job.databases | sha256sum | trunc 32 }}
|
|
|
|
{{- with .Values.podAnnotations }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
labels:
|
2023-09-26 00:12:53 +02:00
|
|
|
{{- include "postgresql.selectorLabels" . | nindent 8 }}
|
|
|
|
spec:
|
|
|
|
restartPolicy: Never
|
|
|
|
{{- with .Values.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
serviceAccountName: {{ include "postgresql.serviceAccountName" . }}
|
|
|
|
securityContext:
|
|
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
|
|
containers:
|
|
|
|
- name: "psql"
|
|
|
|
securityContext:
|
|
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
|
|
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
|
env:
|
|
|
|
- name: "PGHOST"
|
|
|
|
value: {{ include "postgresql.fullname" . | quote }}
|
|
|
|
- name: "PGPORT"
|
|
|
|
value: {{ .Values.service.port | quote }}
|
|
|
|
- name: "PGUSER"
|
|
|
|
value: {{ .Values.postgres.user | quote }}
|
|
|
|
- name: "PGPASSWORD"
|
|
|
|
value: {{ .Values.postgres.password | quote }}
|
|
|
|
command:
|
|
|
|
- "/bin/sh"
|
|
|
|
- "-c"
|
|
|
|
- "cd /bootstrap/ && ./_run"
|
|
|
|
resources:
|
|
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: "/bootstrap/"
|
|
|
|
name: "bootstrap"
|
|
|
|
readOnly: true
|
|
|
|
{{- with .Values.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.tolerations }}
|
|
|
|
tolerations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
volumes:
|
|
|
|
- name: "bootstrap"
|
|
|
|
secret:
|
2023-12-02 00:58:06 +01:00
|
|
|
secretName: {{ include "postgresql.fullname" . }}-bootstrap
|
2023-09-26 00:12:53 +02:00
|
|
|
defaultMode: 0550
|
|
|
|
{{- end }}
|
|
|
|
|