backup-postgres-hook.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {{- if .Values.logsearchapi.enabled -}}
  2. {{- if .Values.ixChartContext.isUpgrade -}}
  3. {{ $values := (. | mustDeepCopy) }}
  4. {{ $_ := set $values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }}
  5. apiVersion: batch/v1
  6. kind: Job
  7. metadata:
  8. name: pre-upgrade-hook
  9. annotations:
  10. "helm.sh/hook": pre-upgrade
  11. "helm.sh/hook-weight": "1"
  12. "helm.sh/hook-delete-policy": hook-succeeded
  13. rollme: {{ randAlphaNum 5 | quote }}
  14. spec:
  15. template:
  16. metadata:
  17. name: pre-upgrade-hook
  18. spec:
  19. restartPolicy: Never
  20. containers:
  21. - name: {{ .Chart.Name }}-postgres-backup
  22. image: {{ include "postgres.imageName" . }}
  23. imagePullPolicy: {{ .Values.image.pullPolicy }}
  24. env: {{ include "postgresBackup.envVariableConfiguration" $values | nindent 10 }}
  25. - name: BACKUP_NAME
  26. value: {{ include "postgres.backupName" . }}
  27. volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
  28. - name: backup-script-configmap
  29. mountPath: /bin/backup_entrypoint.sh
  30. readOnly: true
  31. subPath: entrypoint.sh
  32. command:
  33. - /bin/backup_entrypoint.sh
  34. volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
  35. - name: backup-script-configmap
  36. configMap:
  37. defaultMode: 0700
  38. name: postgres-backup-hook-config-map
  39. {{- end -}}
  40. {{- end -}}