Skip to content

Commit 0e72089

Browse files
authored
Remove annotations arg from GetMongoDBVersion (#1677)
1 parent 6e53d3c commit 0e72089

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

api/v1/mongodbcommunity_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1114,15 +1114,15 @@ func (m *MongoDBCommunity) CurrentArbiters() int {
11141114
return m.Status.CurrentStatefulSetArbitersReplicas
11151115
}
11161116

1117-
func (m *MongoDBCommunity) GetMongoDBVersion(map[string]string) string {
1117+
func (m *MongoDBCommunity) GetMongoDBVersion() string {
11181118
return m.Spec.Version
11191119
}
11201120

11211121
// GetMongoDBVersionForAnnotation returns the MDB version used to annotate the object.
11221122
// Here it's the same as GetMongoDBVersion, but a different name is used in order to make
11231123
// the usage clearer in enterprise (where it's a method of OpsManager but is used for the AppDB)
11241124
func (m *MongoDBCommunity) GetMongoDBVersionForAnnotation() string {
1125-
return m.GetMongoDBVersion(nil)
1125+
return m.GetMongoDBVersion()
11261126
}
11271127

11281128
func (m *MongoDBCommunity) StatefulSetReplicasThisReconciliation() int {

controllers/construct/mongodbstatefulset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type MongoDBStatefulSetOwner interface {
9595
// GetNamespace returns the namespace the resource is defined in.
9696
GetNamespace() string
9797
// GetMongoDBVersion returns the version of MongoDB to be used for this resource.
98-
GetMongoDBVersion(annotations map[string]string) string
98+
GetMongoDBVersion() string
9999
// AutomationConfigSecretName returns the name of the secret which will contain the automation config.
100100
AutomationConfigSecretName() string
101101
// GetUpdateStrategyType returns the UpdateStrategyType of the statefulset.

controllers/replica_set_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func (r ReplicaSetReconciler) Reconcile(ctx context.Context, request reconcile.R
226226
withMongoDBArbiters(mdb.AutomationConfigArbitersThisReconciliation()).
227227
withMessage(None, "").
228228
withRunningPhase().
229-
withVersion(mdb.GetMongoDBVersion(nil)))
229+
withVersion(mdb.GetMongoDBVersion()))
230230
if err != nil {
231231
r.log.Errorf("Error updating the status of the MongoDB resource: %s", err)
232232
return res, err
@@ -491,7 +491,7 @@ func (r *ReplicaSetReconciler) createOrUpdateStatefulSet(ctx context.Context, md
491491
return fmt.Errorf("error getting StatefulSet: %s", err)
492492
}
493493

494-
mongodbImage := getMongoDBImage(r.mongodbRepoUrl, r.mongodbImage, r.mongodbImageType, mdb.GetMongoDBVersion(nil))
494+
mongodbImage := getMongoDBImage(r.mongodbRepoUrl, r.mongodbImage, r.mongodbImageType, mdb.GetMongoDBVersion())
495495
buildStatefulSetModificationFunction(mdb, mongodbImage, r.agentImage, r.versionUpgradeHookImage, r.readinessProbeImage)(&set)
496496
if isArbiter {
497497
buildArbitersModificationFunction(mdb)(&set)

test/e2e/mongodbtests/mongodbtests.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func BasicFunctionality(ctx context.Context, mdb *mdbv1.MongoDBCommunity, skipSt
503503
t.Run("Test Status Was Updated", Status(ctx, mdb, mdbv1.MongoDBCommunityStatus{
504504
MongoURI: mdb.MongoURI(""),
505505
Phase: mdbv1.Running,
506-
Version: mdb.GetMongoDBVersion(nil),
506+
Version: mdb.GetMongoDBVersion(),
507507
CurrentMongoDBMembers: mdb.Spec.Members,
508508
CurrentStatefulSetReplicas: mdb.Spec.Members,
509509
}))

test/e2e/replica_set_recovery/replica_set_recovery_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestReplicaSetRecovery(t *testing.T) {
5959
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
6060
MongoURI: mdb.MongoURI(""),
6161
Phase: mdbv1.Running,
62-
Version: mdb.GetMongoDBVersion(nil),
62+
Version: mdb.GetMongoDBVersion(),
6363
CurrentMongoDBMembers: 3,
6464
CurrentStatefulSetReplicas: 3,
6565
}))

test/e2e/replica_set_scale/replica_set_scaling_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestReplicaSetScaleUp(t *testing.T) {
5454
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
5555
MongoURI: mdb.MongoURI(""),
5656
Phase: mdbv1.Running,
57-
Version: mdb.GetMongoDBVersion(nil),
57+
Version: mdb.GetMongoDBVersion(),
5858
CurrentMongoDBMembers: 5,
5959
CurrentStatefulSetReplicas: 5,
6060
}))

test/e2e/replica_set_scale_down/replica_set_scale_down_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func TestReplicaSetScaleDown(t *testing.T) {
5757
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
5858
MongoURI: mdb.MongoURI(""),
5959
Phase: mdbv1.Running,
60-
Version: mdb.GetMongoDBVersion(nil),
60+
Version: mdb.GetMongoDBVersion(),
6161
CurrentMongoDBMembers: 1,
6262
CurrentStatefulSetReplicas: 1,
6363
}))

test/e2e/statefulset_delete/statefulset_delete_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestStatefulSetDelete(t *testing.T) {
4242
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
4343
MongoURI: mdb.MongoURI(""),
4444
Phase: mdbv1.Running,
45-
Version: mdb.GetMongoDBVersion(nil),
45+
Version: mdb.GetMongoDBVersion(),
4646
CurrentMongoDBMembers: mdb.DesiredReplicas(),
4747
}))
4848
})

0 commit comments

Comments
 (0)