Move AppDB reconcile logic from the Ops Manager controller into ReconcileAppDbReplicaSet#1387
Open
MaciejKaras wants to merge 1 commit into
Open
Move AppDB reconcile logic from the Ops Manager controller into ReconcileAppDbReplicaSet#1387MaciejKaras wants to merge 1 commit into
MaciejKaras wants to merge 1 commit into
Conversation
Contributor
MCK 1.10.0 Release NotesNew Features
Bug Fixes
|
…cileAppDbReplicaSet
MaciejKaras
force-pushed
the
appdb-reconciler-helper
branch
from
July 16, 2026 11:01
8fd365d to
645c846
Compare
MaciejKaras
marked this pull request as ready for review
July 16, 2026 13:22
MaciejKaras
commented
Jul 17, 2026
| } | ||
|
|
||
| // BuildAppDBConnectionURL returns the connection string to the AppDB, ensuring the Ops Manager user password exists. | ||
| func (r *ReconcileAppDbReplicaSet) BuildAppDBConnectionURL(ctx context.Context, opsManager *omv1.MongoDBOpsManager, log *zap.SugaredLogger) (string, error) { |
Collaborator
Author
There was a problem hiding this comment.
new BuildAppDBConnectionURL that returns the connection url to ops manager reconciler, so it can construct secret in each cluster where OM is deployed. Connection URL is the single interface between OpsManager and AppDB
MaciejKaras
commented
Jul 17, 2026
| return r.updateStatus(ctx, opsManager, workflow.Invalid("%s", err.Error()), log, mdbstatus.NewOMPartOption(part)) | ||
| } | ||
|
|
||
| acClient := appDbReconciler.getMemberCluster(appDbReconciler.getNameOfFirstMemberCluster()).Client |
Collaborator
Author
There was a problem hiding this comment.
this whole section was moved to beginning of appDbReconciler.ReconcileAppDB() method
MaciejKaras
commented
Jul 17, 2026
|
|
||
| if opsManager.Spec.AppDB.IsMultiCluster() { | ||
| for _, memberCluster := range appDbReconciler.GetHealthyMemberClusters() { | ||
| appDbHelper, err := NewReadOnlyAppDBReconcilerHelper(ctx, opsManager, r.ReconcileCommonController, r.memberClustersMap, log) |
Collaborator
Author
There was a problem hiding this comment.
here we use only read only helper to get the healthy appDB clusters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves all AppDB-specific logic out of the Ops Manager controller flow into
ReconcileAppDbReplicaSet: the OM controller now interacts with AppDB only throughReconcileAppDB()andBuildAppDBConnectionURL(). This decoupling makes it possible to plug in a differentReconcileAppDbReplicaSetimplementation for the External AppDB required by the Ops Manager Backup project.Additionally,
OnDeletewas constructing a full-blown AppDB reconciler just to list the healthy member clusters. It now uses the new thinAppDBReconcilerHelper(created viaNewReadOnlyAppDBReconcilerHelper), which also skips all state writes during deletion.Notable changes:
ensureResourcesForArchitectureChangemoved from the OM controller intoReconcileAppDB(failures now reported on the AppDB status part; runs after shared-resource/watch setup).BuildAppDBConnectionURL.AppDBReconcilerHelperowns the deployment state and member cluster topology; the reconciler holds it as a field.Proof of Work
Pure refactor — covered by the existing unit test suite (
go test ./controllers/operator/..., green) plus newTestNewAppDBReconcilerHelpercovering persisting/read-only construction, removed-cluster resurrection, and legacy-state fallback. golangci-lint (pinned v2.1.0) and pre-commit clean.Checklist
skip-changeloglabel if not needed