Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
90387b0
Refactor state reading
Julien-Ben Oct 15, 2025
bf0ead1
Refactor state writing
Julien-Ben Oct 17, 2025
ab6e334
Refactor to helper pattern
Julien-Ben Oct 17, 2025
a3fae90
Moved all methods to helper
Julien-Ben Oct 20, 2025
e714e04
Use helper pattern for reconcileHostnameOverrideConfigMap
Julien-Ben Oct 21, 2025
430cb51
Lint
Julien-Ben Oct 21, 2025
894ef00
Rename variables for consistency
Julien-Ben Oct 21, 2025
4bb174c
typo
Julien-Ben Oct 21, 2025
0ae98c8
Rename r := h.reconciler to reconciler
Julien-Ben Oct 21, 2025
95f0686
Rename helper receivers to r
Julien-Ben Oct 21, 2025
08ffa3e
Remove TODOs
Julien-Ben Oct 21, 2025
c99c221
Refactor onDelete
Julien-Ben Oct 21, 2025
5e39e4a
Move comments
Julien-Ben Oct 21, 2025
279a7ac
Update vault annotations only when reconciliation is successful
Julien-Ben Oct 21, 2025
5f5cebd
Handle PVC Resize in a separate method
Julien-Ben Oct 22, 2025
e88439b
Merge branch 'master' into jben/refactor-state-and-helper-pattern
Julien-Ben Oct 22, 2025
b831d72
Add status member count to the state
Julien-Ben Oct 24, 2025
ac8fb33
Uncapitalize errors
Julien-Ben Oct 28, 2025
a777b2f
Write lastAchievedSpec only on successful reconciliation, separate va…
Julien-Ben Oct 28, 2025
d5bdd18
Rename MemberCountBefore
Julien-Ben Oct 28, 2025
bbb173b
Some unit tests for the annotations
Julien-Ben Oct 29, 2025
6ce9706
Merge master into jben/refactor-state-and-helper-pattern
Julien-Ben Oct 29, 2025
2b0d2be
lint
Julien-Ben Oct 30, 2025
9ae637a
Rename variable, remove JSON export
Julien-Ben Oct 31, 2025
370e67b
PR feedback
Julien-Ben Oct 31, 2025
23add7f
Don't export deployment state struct
Julien-Ben Oct 31, 2025
ac3d00f
Remove writeState method for now
Julien-Ben Oct 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1/mdb/mongodb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ func GetLastAdditionalMongodConfigByType(lastSpec *MongoDbSpec, configType Addit

// GetLastAdditionalMongodConfigByType returns the last successfully achieved AdditionalMongodConfigType for the given component.
func (m *MongoDB) GetLastAdditionalMongodConfigByType(configType AdditionalMongodConfigType) (*AdditionalMongodConfig, error) {
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 function is now used by the standalone controller only.
The reason we don't want it any more is because it acceeds the spec with m.GetLastSpec()

We now do it only once per reconcile

if m.Spec.GetResourceType() == ReplicaSet {
panic(errors.Errorf("this method cannot be used from ReplicaSet controller; use non-method GetLastAdditionalMongodConfigByType and pass lastSpec from the deployment state."))
}
if m.Spec.GetResourceType() == ShardedCluster {
panic(errors.Errorf("this method cannot be used from ShardedCluster controller; use non-method GetLastAdditionalMongodConfigByType and pass lastSpec from the deployment state."))
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/om/deployment/testing_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func CreateFromReplicaSet(mongoDBImage string, forceEnterprise bool, rs *mdb.Mon
), zap.S())
d := om.NewDeployment()

lastConfig, err := rs.GetLastAdditionalMongodConfigByType(mdb.ReplicaSetConfig)
lastConfig, err := mdb.GetLastAdditionalMongodConfigByType(nil, mdb.ReplicaSetConfig)
if err != nil {
panic(err)
}
Expand Down
Loading