Skip to content

Commit 6b5e5af

Browse files
m1kolafealebenpae
authored andcommitted
CLOUDP-302068: Decouple CRD types from architectures package (#4118)
`architectures.GetMongoVersionForAutomationConfig` reads from environemnt variables and it makes it difficult parametrise the operator which is something we need to do if we want to merge enterprise and community operators together.
1 parent 450d7c2 commit 6b5e5af

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

api/v1/mdb/mongodb_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/10gen/ops-manager-kubernetes/pkg/fcv"
3131
"github.com/10gen/ops-manager-kubernetes/pkg/kube"
3232
"github.com/10gen/ops-manager-kubernetes/pkg/util"
33-
"github.com/10gen/ops-manager-kubernetes/pkg/util/architectures"
3433
"github.com/10gen/ops-manager-kubernetes/pkg/util/env"
3534
"github.com/10gen/ops-manager-kubernetes/pkg/util/stringutil"
3635
)
@@ -671,7 +670,7 @@ func (m *MongoDB) CurrentReplicas() int {
671670

672671
// GetMongoDBVersion returns the version of the MongoDB.
673672
func (m *MongoDbSpec) GetMongoDBVersion(annotations map[string]string) string {
674-
return architectures.GetMongoVersionForAutomationConfig(m.Version, annotations)
673+
return m.Version
675674
}
676675

677676
func (m *MongoDbSpec) GetClusterDomain() string {

api/v1/mdbmulti/mongodb_multi_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/10gen/ops-manager-kubernetes/pkg/kube"
2828
"github.com/10gen/ops-manager-kubernetes/pkg/multicluster/failedcluster"
2929
"github.com/10gen/ops-manager-kubernetes/pkg/util"
30-
"github.com/10gen/ops-manager-kubernetes/pkg/util/architectures"
3130
intp "github.com/10gen/ops-manager-kubernetes/pkg/util/int"
3231
"github.com/10gen/ops-manager-kubernetes/pkg/util/stringutil"
3332
)
@@ -504,7 +503,7 @@ func (m *MongoDBMultiSpec) GetClusterDomain() string {
504503
}
505504

506505
func (m *MongoDBMultiSpec) GetMongoDBVersion(annotations map[string]string) string {
507-
return architectures.GetMongoVersionForAutomationConfig(m.Version, annotations)
506+
return m.Version
508507
}
509508

510509
func (m *MongoDBMultiSpec) GetSecurityAuthenticationModes() []string {

api/v1/om/appdb_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/10gen/ops-manager-kubernetes/pkg/kube"
2222
"github.com/10gen/ops-manager-kubernetes/pkg/multicluster"
2323
"github.com/10gen/ops-manager-kubernetes/pkg/util"
24-
"github.com/10gen/ops-manager-kubernetes/pkg/util/architectures"
2524
"github.com/10gen/ops-manager-kubernetes/pkg/vault"
2625
)
2726

@@ -280,11 +279,6 @@ type AppDbBuilder struct {
280279
appDb *AppDBSpec
281280
}
282281

283-
// GetMongoDBVersionStatic returns the version of the MongoDB.
284-
func (m *AppDBSpec) GetMongoDBVersionStatic() string {
285-
return architectures.GetMongoVersionForAutomationConfig(m.Version, nil)
286-
}
287-
288282
// GetMongoDBVersion returns the version of the MongoDB.
289283
// For AppDB we directly rely on the version field which can
290284
// contain -ent or not for enterprise and static containers.

controllers/om/process.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
mdbv1 "github.com/10gen/ops-manager-kubernetes/api/v1/mdb"
1414
"github.com/10gen/ops-manager-kubernetes/pkg/tls"
1515
"github.com/10gen/ops-manager-kubernetes/pkg/util"
16+
"github.com/10gen/ops-manager-kubernetes/pkg/util/architectures"
1617
"github.com/10gen/ops-manager-kubernetes/pkg/util/maputil"
1718
)
1819

@@ -396,7 +397,7 @@ type ProcessOption func(process Process)
396397

397398
func WithResourceSpec(resourceSpec mdbv1.DbSpec, annotations map[string]string, fcv string) ProcessOption {
398399
return func(process Process) {
399-
processVersion := resourceSpec.GetMongoDBVersion(annotations)
400+
processVersion := architectures.GetMongoVersionForAutomationConfig(resourceSpec.GetMongoDBVersion(nil), annotations)
400401
process["version"] = processVersion
401402
process["authSchemaVersion"] = CalculateAuthSchemaVersion()
402403
process["featureCompatibilityVersion"] = fcv

0 commit comments

Comments
 (0)