Skip to content

CLOUDP-332914: Cleanup: Remove MDB_ASSUME_ENTERPRISE_IMAGE #283

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
## Other Changes
* Optional permissions for `PersistentVolumeClaim` moved to a separate role. When managing the operator with Helm it is possible to disable permissions for `PersistentVolumeClaim` resources by setting `operator.enablePVCResize` value to `false` (`true` by default). When enabled, previously these permissions were part of the primary operator role. With this change, permissions have a separate role.
* `subresourceEnabled` Helm value was removed. This setting used to be `true` by default and made it possible to exclude subresource permissions from the operator role by specifying `false` as the value. We are removing this configuration option, making the operator roles always have subresource permissions. This setting was introduced as a temporary solution for [this](https://bugzilla.redhat.com/show_bug.cgi?id=1803171) OpenShift issue. The issue has since been resolved and the setting is no longer needed.
* The `MDB_ASSUME_ENTERPRISE_IMAGE` environment variable has been removed. This undocumented environment variable, when set to `true`, forced the `-ent` suffix for the database image version in static architecture. If you are mirroring images and were using this variable, ensure that you do not rename the server image. The name must contain `mongodb-enterprise-server`; otherwise, the operator will not function correctly.


<!-- Past Releases -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: MDB_ASSUME_ENTERPRISE_IMAGE environment variable has been removed
kind: other
date: 2025-07-22
---

* The `MDB_ASSUME_ENTERPRISE_IMAGE` environment variable has been removed. This undocumented environment variable, when set to `true`, forced the `-ent` suffix for the database image version in static architecture. If you are mirroring images and were using this variable, ensure that you do not rename the server image. The name must contain `mongodb-enterprise-server`; otherwise, the operator will not function correctly.
4 changes: 2 additions & 2 deletions controllers/om/deployment/om_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ func init() {
func TestPrepareScaleDown_OpsManagerRemovedMember(t *testing.T) {
// This is deployment with 2 members (emulating that OpsManager removed the 3rd one)
rs := mdbv1.NewReplicaSetBuilder().SetName("bam").SetMembers(2).Build()
oldDeployment := CreateFromReplicaSet("fake-mongoDBImage", false, rs)
oldDeployment := CreateFromReplicaSet("fake-mongoDBImage", rs)
mockedOmConnection := om.NewMockedOmConnection(oldDeployment)

// We try to prepare two members for scale down, but one of them will fail (bam-2)
rsWithThreeMembers := map[string][]string{"bam": {"bam-1", "bam-2"}}
assert.NoError(t, replicaset.PrepareScaleDownFromMap(mockedOmConnection, rsWithThreeMembers, rsWithThreeMembers["bam"], zap.S()))

expectedDeployment := CreateFromReplicaSet("fake-mongoDBImage", false, rs)
expectedDeployment := CreateFromReplicaSet("fake-mongoDBImage", rs)

assert.NoError(t, expectedDeployment.MarkRsMembersUnvoted("bam", []string{"bam-1"}))

Expand Down
4 changes: 2 additions & 2 deletions controllers/om/deployment/testing_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// different packages. And test files are only compiled
// when testing that specific package
// https://github.com/golang/go/issues/10184#issuecomment-84465873
func CreateFromReplicaSet(mongoDBImage string, forceEnterprise bool, rs *mdb.MongoDB) om.Deployment {
func CreateFromReplicaSet(mongoDBImage string, rs *mdb.MongoDB) om.Deployment {
sts := construct.DatabaseStatefulSet(*rs, construct.ReplicaSetOptions(
func(options *construct.DatabaseStatefulSetOptions) {
options.PodVars = &env.PodEnvVars{ProjectID: "abcd"}
Expand All @@ -32,7 +32,7 @@ func CreateFromReplicaSet(mongoDBImage string, forceEnterprise bool, rs *mdb.Mon
}

d.MergeReplicaSet(
replicaset.BuildFromStatefulSet(mongoDBImage, forceEnterprise, sts, rs.GetSpec(), rs.Status.FeatureCompatibilityVersion),
replicaset.BuildFromStatefulSet(mongoDBImage, sts, rs.GetSpec(), rs.Status.FeatureCompatibilityVersion),
rs.Spec.AdditionalMongodConfig.ToMap(),
lastConfig.ToMap(),
zap.S(),
Expand Down
10 changes: 5 additions & 5 deletions controllers/om/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMergeReplicaSet(t *testing.T) {

// Now the deployment "gets updated" from external - new node is added and one is removed - this should be fixed
// by merge
newProcess := NewMongodProcess("foo", "bar", "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, &mdbv1.NewStandaloneBuilder().Build().Spec, "", nil, "")
newProcess := NewMongodProcess("foo", "bar", "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, &mdbv1.NewStandaloneBuilder().Build().Spec, "", nil, "")

d.getProcesses()[0]["processType"] = ProcessTypeMongos // this will be overriden
d.getProcesses()[1].EnsureNetConfig()["MaxIncomingConnections"] = 20 // this will be left as-is
Expand Down Expand Up @@ -741,15 +741,15 @@ func buildRsByProcesses(rsName string, processes []Process) ReplicaSetWithProces
}

func createStandalone() Process {
return NewMongodProcess("merchantsStandalone", "mongo1.some.host", "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
return NewMongodProcess("merchantsStandalone", "mongo1.some.host", "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
}

func createMongosProcesses(num int, name, clusterName string) []Process {
mongosProcesses := make([]Process, num)

for i := 0; i < num; i++ {
idx := strconv.Itoa(i)
mongosProcesses[i] = NewMongosProcess(name+idx, "mongoS"+idx+".some.host", "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
mongosProcesses[i] = NewMongosProcess(name+idx, "mongoS"+idx+".some.host", "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
if clusterName != "" {
mongosProcesses[i].setCluster(clusterName)
}
Expand All @@ -765,7 +765,7 @@ func createReplicaSetProcessesCount(count int, rsName string) []Process {
rsMembers := make([]Process, count)

for i := 0; i < count; i++ {
rsMembers[i] = NewMongodProcess(fmt.Sprintf("%s-%d", rsName, i), fmt.Sprintf("%s-%d.some.host", rsName, i), "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
rsMembers[i] = NewMongodProcess(fmt.Sprintf("%s-%d", rsName, i), fmt.Sprintf("%s-%d.some.host", rsName, i), "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3"), "", nil, "")
// Note that we don't specify the replicaset config for process
}
return rsMembers
Expand All @@ -775,7 +775,7 @@ func createReplicaSetProcessesCountEnt(count int, rsName string) []Process {
rsMembers := make([]Process, count)

for i := 0; i < count; i++ {
rsMembers[i] = NewMongodProcess(fmt.Sprintf("%s-%d", rsName, i), fmt.Sprintf("%s-%d.some.host", rsName, i), "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3-ent"), "", nil, "")
rsMembers[i] = NewMongodProcess(fmt.Sprintf("%s-%d", rsName, i), fmt.Sprintf("%s-%d.some.host", rsName, i), "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, defaultMongoDBVersioned("3.6.3-ent"), "", nil, "")
// Note that we don't specify the replicaset config for process
}
return rsMembers
Expand Down
2 changes: 1 addition & 1 deletion controllers/om/depshardedcluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestMergeShardedCluster_ReplicaSetsModified(t *testing.T) {
// These OM changes must be overriden
(*d.getReplicaSetByName("cluster-0"))["protocolVersion"] = util.Int32Ref(2)
(*d.getReplicaSetByName("configSrv")).addMember(
NewMongodProcess("foo", "bar", "fake-mongoDBImage", false, &mdbv1.AdditionalMongodConfig{}, mdbv1.NewStandaloneBuilder().Build().GetSpec(), "", nil, ""), "", automationconfig.MemberOptions{},
NewMongodProcess("foo", "bar", "fake-mongoDBImage", &mdbv1.AdditionalMongodConfig{}, mdbv1.NewStandaloneBuilder().Build().GetSpec(), "", nil, ""), "", automationconfig.MemberOptions{},
)
(*d.getReplicaSetByName("cluster-2")).setMembers(d.getReplicaSetByName("cluster-2").Members()[0:2])

Expand Down
8 changes: 4 additions & 4 deletions controllers/om/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ func NewProcessFromInterface(i interface{}) Process {
return i.(map[string]interface{})
}

func NewMongosProcess(name, hostName, mongoDBImage string, forceEnterprise bool, additionalMongodConfig *mdbv1.AdditionalMongodConfig, spec mdbv1.DbSpec, certificateFilePath string, annotations map[string]string, fcv string) Process {
func NewMongosProcess(name, hostName, mongoDBImage string, additionalMongodConfig *mdbv1.AdditionalMongodConfig, spec mdbv1.DbSpec, certificateFilePath string, annotations map[string]string, fcv string) Process {
if additionalMongodConfig == nil {
additionalMongodConfig = mdbv1.NewEmptyAdditionalMongodConfig()
}

architecture := architectures.GetArchitecture(annotations)
processVersion := architectures.GetMongoVersionForAutomationConfig(mongoDBImage, spec.GetMongoDBVersion(), forceEnterprise, architecture)
processVersion := architectures.GetMongoVersionForAutomationConfig(mongoDBImage, spec.GetMongoDBVersion(), architecture)
p := createProcess(
WithName(name),
WithHostname(hostName),
Expand All @@ -119,13 +119,13 @@ func NewMongosProcess(name, hostName, mongoDBImage string, forceEnterprise bool,
return p
}

func NewMongodProcess(name, hostName, mongoDBImage string, forceEnterprise bool, additionalConfig *mdbv1.AdditionalMongodConfig, spec mdbv1.DbSpec, certificateFilePath string, annotations map[string]string, fcv string) Process {
func NewMongodProcess(name, hostName, mongoDBImage string, additionalConfig *mdbv1.AdditionalMongodConfig, spec mdbv1.DbSpec, certificateFilePath string, annotations map[string]string, fcv string) Process {
if additionalConfig == nil {
additionalConfig = mdbv1.NewEmptyAdditionalMongodConfig()
}

architecture := architectures.GetArchitecture(annotations)
processVersion := architectures.GetMongoVersionForAutomationConfig(mongoDBImage, spec.GetMongoDBVersion(), forceEnterprise, architecture)
processVersion := architectures.GetMongoVersionForAutomationConfig(mongoDBImage, spec.GetMongoDBVersion(), architecture)
p := createProcess(
WithName(name),
WithHostname(hostName),
Expand Down
8 changes: 4 additions & 4 deletions controllers/om/process/om_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/mongodb/mongodb-kubernetes/pkg/util"
)

func CreateMongodProcessesWithLimit(mongoDBImage string, forceEnterprise bool, set appsv1.StatefulSet, dbSpec mdbv1.DbSpec, limit int, fcv string) []om.Process {
func CreateMongodProcessesWithLimit(mongoDBImage string, set appsv1.StatefulSet, dbSpec mdbv1.DbSpec, limit int, fcv string) []om.Process {
hostnames, names := dns.GetDnsForStatefulSetReplicasSpecified(set, dbSpec.GetClusterDomain(), limit, dbSpec.GetExternalDomain())
processes := make([]om.Process, len(hostnames))

Expand All @@ -23,14 +23,14 @@ func CreateMongodProcessesWithLimit(mongoDBImage string, forceEnterprise bool, s
}

for idx, hostname := range hostnames {
processes[idx] = om.NewMongodProcess(names[idx], hostname, mongoDBImage, forceEnterprise, dbSpec.GetAdditionalMongodConfig(), dbSpec, certificateFileName, set.Annotations, fcv)
processes[idx] = om.NewMongodProcess(names[idx], hostname, mongoDBImage, dbSpec.GetAdditionalMongodConfig(), dbSpec, certificateFileName, set.Annotations, fcv)
}

return processes
}

// CreateMongodProcessesWithLimitMulti creates the process array for automationConfig based on MultiCluster CR spec
func CreateMongodProcessesWithLimitMulti(mongoDBImage string, forceEnterprise bool, mrs mdbmultiv1.MongoDBMultiCluster, certFileName string) ([]om.Process, error) {
func CreateMongodProcessesWithLimitMulti(mongoDBImage string, mrs mdbmultiv1.MongoDBMultiCluster, certFileName string) ([]om.Process, error) {
hostnames := make([]string, 0)
clusterNums := make([]int, 0)
podNum := make([]int, 0)
Expand All @@ -50,7 +50,7 @@ func CreateMongodProcessesWithLimitMulti(mongoDBImage string, forceEnterprise bo

processes := make([]om.Process, len(hostnames))
for idx := range hostnames {
processes[idx] = om.NewMongodProcess(fmt.Sprintf("%s-%d-%d", mrs.Name, clusterNums[idx], podNum[idx]), hostnames[idx], mongoDBImage, forceEnterprise, mrs.Spec.GetAdditionalMongodConfig(), &mrs.Spec, certFileName, mrs.Annotations, mrs.CalculateFeatureCompatibilityVersion())
processes[idx] = om.NewMongodProcess(fmt.Sprintf("%s-%d-%d", mrs.Name, clusterNums[idx], podNum[idx]), hostnames[idx], mongoDBImage, mrs.Spec.GetAdditionalMongodConfig(), &mrs.Spec, certFileName, mrs.Annotations, mrs.CalculateFeatureCompatibilityVersion())
}

return processes, nil
Expand Down
Loading