Skip to content

Commit 03dd9f4

Browse files
Fix backup for non Openshift cluster
1 parent 5d0f91e commit 03dd9f4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

roles/backup/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ To customize the pg_dump command that will be executed on a backup use the `pg_d
105105
pg_dump_suffix: "--exclude-table-data 'main_jobevent*' --exclude-table-data 'main_job'"
106106
```
107107
108+
When using a hostPath backed PVC and some other storage classes like longhorn storagfe, the postgres data directory needs to be accessible by the user in the postgres pod (UID 26).
109+
110+
To initialize this directory with the correct permissions, configure the following setting, which will use an init container to set the permissions in the postgres volume.
111+
112+
```
113+
init_container_commands: |
114+
chown 26:0 /backups
115+
chmod 700 /backups
116+
```
117+
108118
Testing
109119
----------------
110120

roles/backup/templates/management-pod.yml.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ metadata:
77
labels:
88
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
99
spec:
10+
{% if postgres_data_volume_init and not is_openshift %}
11+
initContainers:
12+
- name: init
13+
image: '{{ _postgres_image }}'
14+
command:
15+
- "/bin/sh"
16+
- "-c"
17+
- |
18+
{{ init_container_commands | indent(width=14) }}
19+
volumeMounts:
20+
- name: {{ ansible_operator_meta.name }}-backup
21+
mountPath: /backups
22+
readOnly: false
23+
{% endif %}
1024
containers:
1125
- name: {{ ansible_operator_meta.name }}-db-management
1226
image: "{{ _postgres_image }}"

0 commit comments

Comments
 (0)