Skip to content

Conversation

@rewantsoni
Copy link
Member

Refactor the mirroring controller to disable mirroring on cephblockpool and rns when the secondary cluster is down.

Fixes: DFBUGS-2957, DFBUGS-3638

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rewantsoni
Once this PR has been reviewed and has the lgtm label, please assign iamniting for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rewantsoni rewantsoni force-pushed the mirroring branch 4 times, most recently from 0df4775 to 111f01e Compare July 22, 2025 03:34
@rewantsoni
Copy link
Member Author

/hold for testing

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2025
@nb-ohad
Copy link
Contributor

nb-ohad commented Jul 27, 2025

@rewantsoni This refactor introduce a lot of noise into the code base. Although the shouldMirror is only calculated once, the decision on how to act on it is spread all over the reconcile function and even being passed downward into other sub functions. Preferably the decision need to be made as early as possible in the reconcile flow then a reconcile path is being choosed based on the result. Doing it this way will benefit the code base, the readability and the ability to reason about the flow.

@rewantsoni
Copy link
Member Author

@rewantsoni This refactor introduce a lot of noise into the code base. Although the shouldMirror is only calculated once, the decision on how to act on it is spread all over the reconcile function and even being passed downward into other sub functions. Preferably the decision need to be made as early as possible in the reconcile flow then a reconcile path is being choosed based on the result. Doing it this way will benefit the code base, the readability and the ability to reason about the flow.

@nb-ohad The problem is that we need to reconcile RBDMirror, CephBlockPools, and Radosnamespace in both cases. When shouldMirror is true we need to deploy rbdMirror, enable mirroring on cephblockpools and enable mirroring on radosnamespace as well. When it is set to false, we need to delete RBDMirror, disable mirroring on cephBlockPool and disable mirroring on radosnamespace as well. Along with this we also need to make sure that if a blockpool is labeled with forbid Mirroring label we probably should disable the mirroring on it as well.

What I can do to increase readability is move the rpc calls inside shouldMirror and then call reconcile RBDMirror, CephBlockPools, and Radosnamespace in both cases to enable/disable mirroring based on the in-memory map that we create from the rpc responses.

@rewantsoni
Copy link
Member Author

/cherry-pick release-4.19

@openshift-cherrypick-robot

@rewantsoni: once the present PR merges, I will cherry-pick it on top of release-4.19 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-4.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rewantsoni rewantsoni force-pushed the mirroring branch 2 times, most recently from 6c4fa66 to 75ef66f Compare August 11, 2025 12:18
@rewantsoni rewantsoni force-pushed the mirroring branch 3 times, most recently from a36a2be to 9e3abec Compare September 10, 2025 07:33
@rewantsoni
Copy link
Member Author

Tested it on a cluster, mirroring is disabled for cephblockpool and rns.
/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2025
@rewantsoni
Copy link
Member Author

/cherry-pick release-4.20

@openshift-cherrypick-robot

@rewantsoni: once the present PR merges, I will cherry-pick it on top of release-4.20 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-4.20

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rewantsoni rewantsoni requested a review from leelavg September 10, 2025 07:37
@rewantsoni rewantsoni force-pushed the mirroring branch 2 times, most recently from 362ccd0 to b5d2f73 Compare September 16, 2025 12:19
@agarwal-mudit agarwal-mudit requested a review from nb-ohad January 20, 2026 05:22
Signed-off-by: Rewant Soni <resoni@redhat.com>
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.

4 participants