Skip to content

Commit

Permalink
Update VRG manifest work when drcluster is deleted
Browse files Browse the repository at this point in the history
When a drcluster is deleted, the VRG s3 profiles list changes, so we
need to update the manifestwork.

In ensureVRGManifestWork() we skipped updating the manifestwork if the
VRG exists, now we always update the manifestwork. This requires little
bit more work for every reconcile, but should be efficient enough since
the vrg and manifestwork are cached.

Issues:

- It is not clear if ensureVRGManifestWork() is safe only for primary
  vrg, and it callers are using it correctly. But if we had wrong
  callers before, this change increases the impact of a wrong call,
  updating existing VRG which was not updated before. Add a TODO to look
  at this later, so we can test replace cluster flow now.

- The VRG is updated few minutes after detecting a deleted drcluster,
  since we don't watch drcluster delete events, and we filter drclsuter
  events only for drpc failing over to updated clusters.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs authored and ShyamsundarR committed Dec 13, 2023
1 parent c75ee6b commit b8bedb9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions controllers/drplacementcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -1454,16 +1454,9 @@ func (d *DRPCInstance) createVRGManifestWork(homeCluster string, repState rmn.Re
return nil
}

// ensureVRGManifestWork ensures that the VRG ManifestWork exists and matches the current VRG state.
// TODO: This may be safe only when the VRG is primary - check if callers use this correctly.
func (d *DRPCInstance) ensureVRGManifestWork(homeCluster string) error {
mw, mwErr := d.mwu.FindManifestWorkByType(rmnutil.MWTypeVRG, homeCluster)
if mwErr != nil {
d.log.Info("Ensure VRG ManifestWork", "Error", mwErr)
}

if mw != nil {
return nil
}

d.log.Info("Ensure VRG ManifestWork",
"Last State:", d.getLastDRState(), "cluster", homeCluster)

Expand Down

0 comments on commit b8bedb9

Please sign in to comment.