Files
chart/library/ix-dev/charts/nextcloud/templates/backup-postgres-hook.yaml
Stavros Kois 0124e8d02a NAS-123939 / 24.04 / fix postgres backup in nextcloud (#1513)
* fix postgres backup in nextcloud

* fix value fetching
2023-09-12 21:35:54 +03:00

49 lines
1.7 KiB
YAML

{{- if .Values.ixChartContext.isUpgrade -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
{{ $dbHost := .Values.nextcloudDbHost }}
apiVersion: batch/v1
kind: Job
metadata:
name: "pre-upgrade-hook2"
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded
rollme: {{ randAlphaNum 5 | quote }}
spec:
template:
metadata:
name: "pre-upgrade-hook2"
spec:
restartPolicy: Never
serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
containers:
- name: {{ .Chart.Name }}-postgres-backup
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
- name: BACKUP_NAME
value: {{ template "postgres.backupName" . }}
- name: POSTGRES_HOST
value: {{ $dbHost }}
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
- name: backup-script-configmap
mountPath: /bin/backup_entrypoint.sh
readOnly: true
subPath: entrypoint.sh
- name: nextcloud-data
mountPath: /nc-config
subPath: "config"
command:
- "/bin/backup_entrypoint.sh"
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
- name: backup-script-configmap
configMap:
defaultMode: 0700
name: "postgres-backup-hook-config-map"
{{ if .Values.appVolumeMounts }}
{{- include "common.storage.configureAppVolumes" .Values | nindent 8 }}
{{ end }}
{{- end -}}