From 6eb5a5848b31a6d9c1911a19db30987a8ab18472 Mon Sep 17 00:00:00 2001 From: Ranvit Bommineni Date: Fri, 10 May 2024 16:59:53 -0500 Subject: [PATCH] assign ownership of backup pvc to postgres image's uid --- roles/backup/templates/management-pod.yml.j2 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/backup/templates/management-pod.yml.j2 b/roles/backup/templates/management-pod.yml.j2 index 633d699e5..c9f2db821 100644 --- a/roles/backup/templates/management-pod.yml.j2 +++ b/roles/backup/templates/management-pod.yml.j2 @@ -7,6 +7,15 @@ metadata: labels: {{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} spec: + initContainers: + - name: init-pvc-chown + image: busybox + # _postgres_image runs as uid 26 + command: ["sh", "-c", "chown -R :26 /backups && chmod -R 770 /backups"] + volumeMounts: + - name: {{ ansible_operator_meta.name }}-backup + mountPath: /backups + readOnly: false containers: - name: {{ ansible_operator_meta.name }}-db-management image: "{{ _postgres_image }}"