Skip to content

Fix custom backup PVC name not used with create_backup_pvc#2105

Merged
aknochow merged 1 commit intoansible:develfrom
aknochow:fix/custom-backup-pvc-name
Mar 5, 2026
Merged

Fix custom backup PVC name not used with create_backup_pvc#2105
aknochow merged 1 commit intoansible:develfrom
aknochow:fix/custom-backup-pvc-name

Conversation

@aknochow
Copy link
Member

@aknochow aknochow commented Mar 5, 2026

ISSUE TYPE

New or Enhanced Feature

Summary

Fix custom backup PVC name not being used when create_backup_pvc: true and backup_pvc is specified.

Problem

When a user specifies backup_pvc: my-custom-pvc with create_backup_pvc: true, the operator creates a PVC named {deployment_name}-backup-claim (the hardcoded default) instead of my-custom-pvc. The management pod then tries to mount the custom-named PVC which doesn't exist, causing the backup to hang.

The backup_claim variable was correctly resolved from backup_pvc, but the PVC template and ownerReference removal used the hardcoded {{ deployment_name }}-backup-claim name instead.

Solution

Replace the backup_claim variable with backup_pvc throughout the backup role. The set_fact now resolves backup_pvc directly (defaulting to {deployment_name}-backup-claim when not specified), and all templates reference {{ backup_pvc }}.

Changes

  • roles/backup/tasks/init.yml: set_fact resolves backup_pvc instead of backup_claim; ownerRef removal uses {{ backup_pvc }}
  • roles/backup/templates/backup_pvc.yml.j2: PVC name uses {{ backup_pvc }}
  • roles/backup/templates/management-pod.yml.j2: claimName uses {{ backup_pvc }}
  • roles/backup/tasks/update_status.yml: backupClaim uses {{ backup_pvc }}

Testing

Tested on MicroShift with custom backup PVC names and sizes per component. All PVCs created with correct custom names and backup completed successfully.

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 so the resolved PVC name is used consistently in all templates.

Authored By: Adam Knochowski <aknochow@redhat.com>
Assisted By: Claude
@aknochow aknochow force-pushed the fix/custom-backup-pvc-name branch from 1c8306c to 20eda56 Compare March 5, 2026 00:23
@rooftopcellist
Copy link
Member

rooftopcellist commented Mar 5, 2026

@aknochow you need to add the "change type" to the PR description body for CI to pass.

ISSUE TYPE

  • New or Enhanced Feature

@aknochow aknochow merged commit 56f10cf into ansible:devel Mar 5, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants