Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions roles/backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ To customize the pg_dump command that will be executed on a backup use the `pg_d
pg_dump_suffix: "--exclude-table-data 'main_jobevent*' --exclude-table-data 'main_job'"
```

When using a hostPath backed PVC and some other storage classes like longhorn storage, the postgres data directory needs to be accessible by the user in the postgres pod (UID 26).

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.

```
init_container_commands: |
chown 26:0 /backups
chmod 700 /backups
```

Testing
----------------

Expand Down
14 changes: 14 additions & 0 deletions roles/backup/templates/management-pod.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ metadata:
labels:
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }}
spec:
{% if init_container_commands %}
initContainers:
- name: init
image: '{{ _postgres_image }}'
command:
- "/bin/sh"
- "-c"
- |
{{ init_container_commands | indent(width=14) }}
volumeMounts:
- name: {{ ansible_operator_meta.name }}-backup
mountPath: /backups
readOnly: false
{% endif %}
containers:
- name: {{ ansible_operator_meta.name }}-db-management
image: "{{ _postgres_image }}"
Expand Down