Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for PVC label selector conflicts against the secondary cluster. - WIP(Need to test) #1855

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ func (v *VRGInstance) reconcileVolRepsAsSecondary() bool {
v.pvcStatusDeleteIfPresent(pvc.Namespace, pvc.Name, log)
}

// Ensure that no PVC on the secondary cluster matches the label selector.
// This check runs after all protected PVCs have been cleaned up in the previous step.
if !requeue && len(v.volRepPVCs) > 0 {
requeue = true

v.log.Info("No PVC on the secondary should match the label selector")
}

if !requeue {
v.log.Info("Successfully reconciled VolRep as Secondary")
}

return requeue
}

Expand Down
12 changes: 12 additions & 0 deletions internal/controller/vrg_volsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,18 @@ func (v *VRGInstance) reconcileVolSyncAsSecondary() bool {

v.instance.Status.ProtectedPVCs = v.instance.Status.ProtectedPVCs[:idx]
v.log.Info("Protected PVCs left", "ProtectedPVCs", v.instance.Status.ProtectedPVCs)
} else {
// Perform a PVC conflict check against the secondary cluster.
// Ensures that PVCs matching the label selector are properly validated before protection.
for _, rdSpec := range v.instance.Spec.VolSync.RDSpec {
for _, pvc := range v.volSyncPVCs {
if pvc.GetName() != rdSpec.ProtectedPVC.Name {
v.log.Info("A PVC that is not a replication destination should not match the label selector.")

return true
}
}
}
}

// Reset status finalsync flags and condition
Expand Down
Loading