Skip to content

CLOUDP-323997: Refactor replicaset controller #185

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Julien-Ben
Copy link
Collaborator

@Julien-Ben Julien-Ben commented Jun 6, 2025

Summary

Some refactoring work done in the MongoDB Replica Set controller to bring it closer to the structure of the multi cluster controller.
The aim is to break down the large reconcile loop into smaller parts

Proof of Work

We must observe no regression in E2E tests

Move reconcile hostname override cm

Move reconciling of k8s resources
@@ -65,36 +63,7 @@ func PrepareScaleDownFromMap(omClient om.Connection, rsMembers map[string][]stri
log.Debugw("Marked replica set members as non-voting", "replica set with members", rsMembers)
}

// TODO practice shows that automation agents can get stuck on setting db to "disabled" also it seems that this process
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment dated from 2021

return r.updateStatus(ctx, rs, status, log)
}

if scale.ReplicasThisReconciliation(rs) < rs.Status.Members {
Copy link
Collaborator Author

@Julien-Ben Julien-Ben Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore
Related Jira ticket (from 2017): https://jira.mongodb.org/browse/HELP-3818

From the ticket, this step was necessary to scale a replica set to a single member.
We have a test covering that case

def test_replica_set_can_be_scaled_to_single_member(replica_set: MongoDB):

Note that the multi cluster replica set controller does not perform an equivalent step.

@Julien-Ben Julien-Ben changed the title Refactor replicaset controller CLOUDP-323997 : Refactor replicaset controller Jun 11, 2025
@Julien-Ben Julien-Ben changed the title CLOUDP-323997 : Refactor replicaset controller CLOUDP-323997: Refactor replicaset controller Jun 11, 2025
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.

1 participant