Skip to content

Commit 615f9b2

Browse files
committed
Update volsync-pvc-backup-restore.yaml
1 parent 4d7b5d1 commit 615f9b2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

infrastructure/controllers/kyverno/policies/volsync-pvc-backup-restore.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ spec:
117117
property: kopia_password
118118

119119
# Rule 2: Generate ReplicationSource (backup schedule)
120+
# IMPORTANT: Only create backup AFTER PVC is Bound to avoid conflicts with restore
120121
- name: generate-replication-source
121122
skipBackgroundRequests: false
122123
match:
@@ -136,6 +137,13 @@ spec:
136137
- kube-system
137138
- volsync-system
138139
- kyverno
140+
preconditions:
141+
all:
142+
# Only create backup ReplicationSource after PVC is Bound
143+
# This prevents backup from running during restore (when PVC is Pending)
144+
- key: "{{ request.object.status.phase || 'Pending' }}"
145+
operator: Equals
146+
value: "Bound"
139147
generate:
140148
synchronize: true
141149
apiVersion: volsync.backube/v1alpha1

0 commit comments

Comments
 (0)