Skip to content

CLOUDP-302068: Remove annotations arg from GetMongoDBVersion #1677

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions api/v1/mongodbcommunity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,15 +1114,15 @@ func (m *MongoDBCommunity) CurrentArbiters() int {
return m.Status.CurrentStatefulSetArbitersReplicas
}

func (m *MongoDBCommunity) GetMongoDBVersion(map[string]string) string {
func (m *MongoDBCommunity) GetMongoDBVersion() string {
return m.Spec.Version
}

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

func (m *MongoDBCommunity) StatefulSetReplicasThisReconciliation() int {
Expand Down
2 changes: 1 addition & 1 deletion controllers/construct/mongodbstatefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type MongoDBStatefulSetOwner interface {
// GetNamespace returns the namespace the resource is defined in.
GetNamespace() string
// GetMongoDBVersion returns the version of MongoDB to be used for this resource.
GetMongoDBVersion(annotations map[string]string) string
GetMongoDBVersion() string
// AutomationConfigSecretName returns the name of the secret which will contain the automation config.
AutomationConfigSecretName() string
// GetUpdateStrategyType returns the UpdateStrategyType of the statefulset.
Expand Down
4 changes: 2 additions & 2 deletions controllers/replica_set_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (r ReplicaSetReconciler) Reconcile(ctx context.Context, request reconcile.R
withMongoDBArbiters(mdb.AutomationConfigArbitersThisReconciliation()).
withMessage(None, "").
withRunningPhase().
withVersion(mdb.GetMongoDBVersion(nil)))
withVersion(mdb.GetMongoDBVersion()))
if err != nil {
r.log.Errorf("Error updating the status of the MongoDB resource: %s", err)
return res, err
Expand Down Expand Up @@ -491,7 +491,7 @@ func (r *ReplicaSetReconciler) createOrUpdateStatefulSet(ctx context.Context, md
return fmt.Errorf("error getting StatefulSet: %s", err)
}

mongodbImage := getMongoDBImage(r.mongodbRepoUrl, r.mongodbImage, r.mongodbImageType, mdb.GetMongoDBVersion(nil))
mongodbImage := getMongoDBImage(r.mongodbRepoUrl, r.mongodbImage, r.mongodbImageType, mdb.GetMongoDBVersion())
buildStatefulSetModificationFunction(mdb, mongodbImage, r.agentImage, r.versionUpgradeHookImage, r.readinessProbeImage)(&set)
if isArbiter {
buildArbitersModificationFunction(mdb)(&set)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/mongodbtests/mongodbtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func BasicFunctionality(ctx context.Context, mdb *mdbv1.MongoDBCommunity, skipSt
t.Run("Test Status Was Updated", Status(ctx, mdb, mdbv1.MongoDBCommunityStatus{
MongoURI: mdb.MongoURI(""),
Phase: mdbv1.Running,
Version: mdb.GetMongoDBVersion(nil),
Version: mdb.GetMongoDBVersion(),
CurrentMongoDBMembers: mdb.Spec.Members,
CurrentStatefulSetReplicas: mdb.Spec.Members,
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestReplicaSetRecovery(t *testing.T) {
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
MongoURI: mdb.MongoURI(""),
Phase: mdbv1.Running,
Version: mdb.GetMongoDBVersion(nil),
Version: mdb.GetMongoDBVersion(),
CurrentMongoDBMembers: 3,
CurrentStatefulSetReplicas: 3,
}))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/replica_set_scale/replica_set_scaling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestReplicaSetScaleUp(t *testing.T) {
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
MongoURI: mdb.MongoURI(""),
Phase: mdbv1.Running,
Version: mdb.GetMongoDBVersion(nil),
Version: mdb.GetMongoDBVersion(),
CurrentMongoDBMembers: 5,
CurrentStatefulSetReplicas: 5,
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestReplicaSetScaleDown(t *testing.T) {
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
MongoURI: mdb.MongoURI(""),
Phase: mdbv1.Running,
Version: mdb.GetMongoDBVersion(nil),
Version: mdb.GetMongoDBVersion(),
CurrentMongoDBMembers: 1,
CurrentStatefulSetReplicas: 1,
}))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/statefulset_delete/statefulset_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestStatefulSetDelete(t *testing.T) {
t.Run("Test Status Was Updated", mongodbtests.Status(ctx, &mdb, mdbv1.MongoDBCommunityStatus{
MongoURI: mdb.MongoURI(""),
Phase: mdbv1.Running,
Version: mdb.GetMongoDBVersion(nil),
Version: mdb.GetMongoDBVersion(),
CurrentMongoDBMembers: mdb.DesiredReplicas(),
}))
})
Expand Down
Loading