Skip to content

Commit 1c8306c

Browse files
committed
Use backup_pvc for custom backup PVC name in templates
When backup_pvc is specified with create_backup_pvc: true, the PVC template and ownerReference removal used the hardcoded default name (deployment_name-backup-claim) instead of the user-specified name. This caused the management pod to reference a PVC that didn't exist. Replace backup_claim variable with backup_pvc throughout the backup role to match the gateway operator pattern. Authored By: Adam Knochowski <aknochow@redhat.com> Assisted By: Claude
1 parent c996c88 commit 1c8306c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

roles/backup/tasks/init.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# by default, it will re-use the old pvc if already created (unless a pvc is provided)
4444
- name: Set PVC to use for backup
4545
set_fact:
46-
backup_claim: "{{ backup_pvc | default(_default_backup_pvc, true) }}"
46+
backup_pvc: "{{ backup_pvc | default(_default_backup_pvc, true) }}"
4747

4848
- block:
4949
- name: Create PVC for backup
@@ -57,7 +57,7 @@
5757
apiVersion: v1
5858
kind: PersistentVolumeClaim
5959
metadata:
60-
name: "{{ deployment_name }}-backup-claim"
60+
name: "{{ backup_pvc }}"
6161
namespace: "{{ backup_pvc_namespace }}"
6262
ownerReferences: null
6363
when:

roles/backup/tasks/update_status.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
namespace: "{{ ansible_operator_meta.namespace }}"
1010
status:
1111
backupDirectory: "{{ backup_dir }}"
12-
backupClaim: "{{ backup_claim }}"
12+
backupClaim: "{{ backup_pvc }}"
1313
when: backup_complete

roles/backup/templates/backup_pvc.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: PersistentVolumeClaim
44
metadata:
5-
name: {{ deployment_name }}-backup-claim
5+
name: {{ backup_pvc }}
66
namespace: "{{ backup_pvc_namespace }}"
77
ownerReferences: null
88
labels:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ spec:
2727
volumes:
2828
- name: {{ ansible_operator_meta.name }}-backup
2929
persistentVolumeClaim:
30-
claimName: {{ backup_claim }}
30+
claimName: {{ backup_pvc }}
3131
readOnly: false
3232
restartPolicy: Never

0 commit comments

Comments
 (0)