RamenDR / ramen

Apache License 2.0
70 stars 51 forks source link

Simplify enable DR flow for OCM managed workloads #1442

Closed nirs closed 6 days ago

nirs commented 1 month ago

Currently user need to perform multiple steps, document here: https://github.com/RamenDR/ocm-ramen-samples?tab=readme-ov-file#enable-dr-for-a-deployed-application

Old flow

  1. Add cluster.open-cluster-management.io/experimental-scheduling-disable=true annotation to the placement
  2. Add the drpc resource

If the cluster.open-cluster-management.io/experimental-scheduling-disable=true annotation is missing, Ramen does not protect the application.

New flow

We want to make the process single simple step:

  1. Add the drpc resouce

Ramen will annotate the placement automatically when starting to use the placement.

Ramen will also re-annotate the placement if the annotation is removed while the workload is protected.

nirs commented 1 week ago

This change could make sense if ramen was adding the annotation when enable DR, and removing the annotation when disabling DR, but we cannot do this since the placement may be managed by GitOps.

I think this change is unneeded and unwanted, and we should close this issue.

Ramen currently enforces that a placement has the annotation:

"cluster.open-cluster-management.io/experimental-scheduling-disable"

If a annotation is missing or the value is not "true", ramen will fail to return the placement, and the current reconcile will fail until the placement is fixed. https://github.com/RamenDR/ramen/blob/e63e695ee8fad69b5afb5dea0951f31a40984981/controllers/drplacementcontrol_controller.go#L1468

If we change ramen to add the annotation, it is not clear how should we treat a placement without an annotation. Should we add it if missing instead of failing? Or maybe we should add it only if if the finalizer was not added yet? This is going to be tricky since we remove the finalizer when disable DR.

Looks like the current solution, only handling placement with the annotation, is safer and simpler both for ramen and for users, and it should not change.

The OpenShift code adding the annotation before assigning a dr policy to the application already exists to we don't gain anything by doing this in ramen.