Skip to content

Commit 54b5d7b

Browse files
committed
Remove annotations arg from GetMongoDBVersion
1 parent 7a5cd08 commit 54b5d7b

File tree

8 files changed

+12
-11
lines changed

8 files changed

+12
-11
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

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package construct
22

33
import (
44
"fmt"
5-
"github.com/mongodb/mongodb-kubernetes-operator/pkg/readiness/config"
65
"os"
76
"strconv"
87
"strings"
98

9+
"github.com/mongodb/mongodb-kubernetes-operator/pkg/readiness/config"
10+
1011
"github.com/mongodb/mongodb-kubernetes-operator/pkg/util/envvar"
1112

1213
"github.com/mongodb/mongodb-kubernetes-operator/pkg/automationconfig"
@@ -93,7 +94,7 @@ type MongoDBStatefulSetOwner interface {
9394
// GetNamespace returns the namespace the resource is defined in.
9495
GetNamespace() string
9596
// GetMongoDBVersion returns the version of MongoDB to be used for this resource.
96-
GetMongoDBVersion(annotations map[string]string) string
97+
GetMongoDBVersion() string
9798
// AutomationConfigSecretName returns the name of the secret which will contain the automation config.
9899
AutomationConfigSecretName() string
99100
// GetUpdateStrategyType returns the UpdateStrategyType of the statefulset.
@@ -243,7 +244,7 @@ func BuildMongoDBReplicaSetStatefulSetModificationFunction(mdb MongoDBStatefulSe
243244
podtemplatespec.WithVolume(keyFileVolume),
244245
podtemplatespec.WithServiceAccount(mongodbDatabaseServiceAccountName),
245246
podtemplatespec.WithContainer(AgentName, mongodbAgentContainer(mdb.AutomationConfigSecretName(), mongodbAgentVolumeMounts, agentLogLevel, agentLogFile, agentMaxLogFileDurationHours, agentImage)),
246-
podtemplatespec.WithContainer(MongodbName, mongodbContainer(mdb.GetMongoDBVersion(nil), mongodVolumeMounts, mdb.GetMongodConfiguration())),
247+
podtemplatespec.WithContainer(MongodbName, mongodbContainer(mdb.GetMongoDBVersion(), mongodVolumeMounts, mdb.GetMongodConfiguration())),
247248
upgradeInitContainer,
248249
readinessInitContainer,
249250
),

controllers/replica_set_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (r ReplicaSetReconciler) Reconcile(ctx context.Context, request reconcile.R
212212
withMongoDBArbiters(mdb.AutomationConfigArbitersThisReconciliation()).
213213
withMessage(None, "").
214214
withRunningPhase().
215-
withVersion(mdb.GetMongoDBVersion(nil)))
215+
withVersion(mdb.GetMongoDBVersion()))
216216
if err != nil {
217217
r.log.Errorf("Error updating the status of the MongoDB resource: %s", err)
218218
return res, err

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)