|
|
@@ -0,0 +1,57 @@
|
|
|
+{{- if .Values.ixChartContext.isUpgrade -}}
|
|
|
+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 "nextcloud.serviceAccountName" . }}"
|
|
|
+ containers:
|
|
|
+ - name: {{ .Chart.Name }}-postgres-backup
|
|
|
+ image: {{ template "postgres.imageName" . }}
|
|
|
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
+ env:
|
|
|
+ - name: POSTGRES_USER
|
|
|
+ valueFrom:
|
|
|
+ secretKeyRef:
|
|
|
+ name: db-details
|
|
|
+ key: db-user
|
|
|
+ - name: POSTGRES_PASSWORD
|
|
|
+ valueFrom:
|
|
|
+ secretKeyRef:
|
|
|
+ name: db-details
|
|
|
+ key: db-password
|
|
|
+ - name: BACKUP_NAME
|
|
|
+ value: {{ template "postgres.backupName" . }}
|
|
|
+ volumeMounts:
|
|
|
+ - name: postgres-data
|
|
|
+ mountPath: /var/lib/postgresql/data
|
|
|
+ - name: postgres-backup
|
|
|
+ mountPath: /postgres_backups
|
|
|
+ - name: backup-script-configmap
|
|
|
+ mountPath: /bin/backup_entrypoint.sh
|
|
|
+ readOnly: true
|
|
|
+ subPath: entrypoint.sh
|
|
|
+ command:
|
|
|
+ - "/bin/backup_entrypoint.sh"
|
|
|
+ volumes:
|
|
|
+ - name: postgres-data
|
|
|
+ hostPath:
|
|
|
+ path: {{ template "configuredPostgresHostPath" . }}
|
|
|
+ - name: postgres-backup
|
|
|
+ hostPath:
|
|
|
+ path: {{ template "configuredBackupPostgresHostPath" . }}
|
|
|
+ - name: backup-script-configmap
|
|
|
+ configMap:
|
|
|
+ defaultMode: 0700
|
|
|
+ name: "postgres-backup-hook-config-map"
|
|
|
+{{- end -}}
|