Skip to content

Commit 1988e86

Browse files
authored
CLOUDP-353163: remove search 8.0.10 support (#559)
# Summary This pull request updates the minimum supported MongoDB version for search features to 8.2.0 and removes legacy compatibility logic for older versions. The main changes include raising the version requirements in validation logic and related tests, and cleaning up code that previously polyfilled the Search Coordinator role for older MongoDB versions. **Version requirement updates:** * Raised the minimum MongoDB version required for search features from 8.0.10 to 8.2.0 in both community and enterprise validation logic (`community_search_source.go`, `enterprise_search_source.go`). [[1]](diffhunk://#diff-79689400c088c4485d9ae28b3ca86fe463754f5dec27c956c67849a34ac94e61L67-R68) [[2]](diffhunk://#diff-3837b30e8c3c6c546a85cd00429654741c55ee4b874c5f870050402cfda777deL58-R59) * Updated all related test cases to use 8.2.0 as the minimum version and adjusted version-specific test scenarios accordingly (`community_search_source_test.go`, `enterprise_search_source_test.go`). [[1]](diffhunk://#diff-481a2aca8f821dc66bf882888c48a3a5f1425819db08a225c146396c347339e8L53-R166) [[2]](diffhunk://#diff-481a2aca8f821dc66bf882888c48a3a5f1425819db08a225c146396c347339e8L177-R181) [[3]](diffhunk://#diff-481a2aca8f821dc66bf882888c48a3a5f1425819db08a225c146396c347339e8L191-R191) [[4]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL80-R101) [[5]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL110-R110) [[6]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL119-R127) [[7]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL136-R136) [[8]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL145-R145) [[9]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL154-R154) [[10]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL163-R163) [[11]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL172-R212) [[12]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL221-R221) [[13]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL231-R231) [[14]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL240-R240) [[15]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL255-R259) [[16]](diffhunk://#diff-6bfeddaf7d509b615b96bcc898fc54cf92384660b3b9de35a924acc9edd1c27fL268-R268) * Updated the default version in test object creation to 8.2.0 (`mongodbsearch_controller_test.go`). **Legacy code cleanup:** * Removed the Search Coordinator role polyfill logic from the replica set controller, as it is no longer needed with the new minimum version (`mongodbreplicaset_controller.go`). * Added the changelog entry for removing the MongoDB Search Coordinator polyfill (`changelog/20251015_other_remove_legacy_search_coordinator_polyfill.md`). **Minor dependency cleanup:** * Removed unused imports related to legacy semver and API modules in the search reconcile helper (`mongodbsearch_reconcile_helper.go`). [[1]](diffhunk://#diff-9b1183581cc6af6723f6445d7a14ae4ae7b435dc3b93ca5d82247cda13f7ca39L10) [[2]](diffhunk://#diff-9b1183581cc6af6723f6445d7a14ae4ae7b435dc3b93ca5d82247cda13f7ca39L25) ## Proof of Work Tests pass
1 parent b384e33 commit 1988e86

10 files changed

+58
-238
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
kind: other
3+
date: 2025-10-15
4+
---
5+
6+
* Simplified MongoDB Search setup: Removed the custom Search Coordinator polyfill (a piece of compatibility code previously needed to add the required permissions), as MongoDB 8.2.0 and later now include the necessary permissions via the built-in searchCoordinator role.

controllers/operator/mongodbreplicaset_controller.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -866,15 +866,6 @@ func (r *ReplicaSetReconcilerHelper) applySearchOverrides(ctx context.Context) b
866866
searchMongodConfig := searchcontroller.GetMongodConfigParameters(search, rs.Spec.GetClusterDomain())
867867
rs.Spec.AdditionalMongodConfig.AddOption("setParameter", searchMongodConfig["setParameter"])
868868

869-
if searchcontroller.NeedsSearchCoordinatorRolePolyfill(rs.Spec.GetMongoDBVersion()) {
870-
log.Infof("Polyfilling the searchCoordinator role for MongoDB %s", rs.Spec.GetMongoDBVersion())
871-
872-
if rs.Spec.Security == nil {
873-
rs.Spec.Security = &mdbv1.Security{}
874-
}
875-
rs.Spec.Security.Roles = append(rs.Spec.Security.Roles, searchcontroller.SearchCoordinatorRole())
876-
}
877-
878869
return true
879870
}
880871

controllers/operator/mongodbsearch_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func newMongoDBCommunity(name, namespace string) *mdbcv1.MongoDBCommunity {
3636
Spec: mdbcv1.MongoDBCommunitySpec{
3737
Type: mdbcv1.ReplicaSet,
3838
Members: 1,
39-
Version: "8.0.10",
39+
Version: "8.2.0",
4040
},
4141
}
4242
}

controllers/searchcontroller/community_search_source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ func (r *CommunitySearchSource) Validate() error {
6464
version, err := semver.ParseTolerant(r.GetMongoDBVersion())
6565
if err != nil {
6666
return xerrors.Errorf("error parsing MongoDB version '%s': %w", r.Spec.Version, err)
67-
} else if version.LT(semver.MustParse("8.0.10")) {
68-
return xerrors.New("MongoDB version must be 8.0.10 or higher")
67+
} else if version.LT(semver.MustParse("8.2.0")) {
68+
return xerrors.New("MongoDB version must be 8.2.0 or higher")
6969
}
7070

7171
foundScram := false

controllers/searchcontroller/community_search_source_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,120 +50,120 @@ func TestCommunitySearchSource_Validate(t *testing.T) {
5050
version: "7.0.0",
5151
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
5252
expectError: true,
53-
expectedErrMsg: "MongoDB version must be 8.0.10 or higher",
53+
expectedErrMsg: "MongoDB version must be 8.2.0 or higher",
5454
},
5555
{
5656
name: "Version just below minimum",
57-
version: "8.0.9",
57+
version: "8.1.9",
5858
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
5959
expectError: true,
60-
expectedErrMsg: "MongoDB version must be 8.0.10 or higher",
60+
expectedErrMsg: "MongoDB version must be 8.2.0 or higher",
6161
},
6262
{
6363
name: "Valid minimum version",
64-
version: "8.0.10",
64+
version: "8.2.0",
6565
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
6666
expectError: false,
6767
},
6868
{
6969
name: "Version above minimum",
70-
version: "8.1.0",
70+
version: "8.3.0",
7171
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
7272
expectError: false,
7373
},
7474
{
7575
name: "Version with build number",
76-
version: "8.1.0-rc1",
76+
version: "8.3.0-rc1",
7777
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
7878
expectError: false,
7979
},
8080
// Authentication mode tests - empty/nil cases
8181
{
8282
name: "Empty auth modes",
83-
version: "8.0.10",
83+
version: "8.2.0",
8484
authModes: []mdbcv1.AuthMode{},
8585
expectError: false,
8686
},
8787
{
8888
name: "Nil auth modes",
89-
version: "8.0.10",
89+
version: "8.2.0",
9090
authModes: nil,
9191
expectError: false,
9292
},
9393
{
9494
name: "X509 mode only",
95-
version: "8.0.10",
95+
version: "8.2.0",
9696
authModes: []mdbcv1.AuthMode{"X509"},
9797
expectError: true,
9898
expectedErrMsg: "MongoDBSearch requires SCRAM authentication to be enabled",
9999
},
100100
{
101101
name: "X509 and SCRAM",
102-
version: "8.0.10",
102+
version: "8.2.0",
103103
authModes: []mdbcv1.AuthMode{"X509", "SCRAM-SHA-256"},
104104
expectError: false,
105105
},
106106
{
107107
name: "Multiple auth modes with SCRAM first",
108-
version: "8.0.10",
108+
version: "8.2.0",
109109
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-1", "X509"},
110110
expectError: false,
111111
},
112112
{
113113
name: "Multiple auth modes with SCRAM last",
114-
version: "8.0.10",
114+
version: "8.2.0",
115115
authModes: []mdbcv1.AuthMode{"PLAIN", "X509", "SCRAM-SHA-256"},
116116
expectError: false,
117117
},
118118
{
119119
name: "Multiple non-SCRAM modes",
120-
version: "8.0.10",
120+
version: "8.2.0",
121121
authModes: []mdbcv1.AuthMode{"PLAIN", "X509"},
122122
expectError: true,
123123
expectedErrMsg: "MongoDBSearch requires SCRAM authentication to be enabled",
124124
},
125125
// SCRAM variant tests
126126
{
127127
name: "SCRAM only",
128-
version: "8.0.10",
128+
version: "8.2.0",
129129
authModes: []mdbcv1.AuthMode{"SCRAM"},
130130
expectError: false,
131131
},
132132
{
133133
name: "SCRAM-SHA-1 only",
134-
version: "8.0.10",
134+
version: "8.2.0",
135135
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-1"},
136136
expectError: false,
137137
},
138138
{
139139
name: "SCRAM-SHA-256 only",
140-
version: "8.0.10",
140+
version: "8.2.0",
141141
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
142142
expectError: false,
143143
},
144144
{
145145
name: "All SCRAM variants",
146-
version: "8.0.10",
146+
version: "8.2.0",
147147
authModes: []mdbcv1.AuthMode{"SCRAM", "SCRAM-SHA-1", "SCRAM-SHA-256"},
148148
expectError: false,
149149
},
150150
// Case-insensitive tests (now supported with ToUpper)
151151
{
152152
name: "Lowercase SCRAM",
153-
version: "8.0.10",
153+
version: "8.2.0",
154154
authModes: []mdbcv1.AuthMode{"scram-sha-256"},
155155
expectError: false,
156156
},
157157
{
158158
name: "Mixed case SCRAM",
159-
version: "8.0.10",
159+
version: "8.2.0",
160160
authModes: []mdbcv1.AuthMode{"Scram-Sha-256"},
161161
expectError: false,
162162
},
163163
// Edge case tests
164164
{
165165
name: "PLAIN only",
166-
version: "8.0.10",
166+
version: "8.2.0",
167167
authModes: []mdbcv1.AuthMode{"PLAIN"},
168168
expectError: true,
169169
expectedErrMsg: "MongoDBSearch requires SCRAM authentication to be enabled",
@@ -174,11 +174,11 @@ func TestCommunitySearchSource_Validate(t *testing.T) {
174174
version: "7.0.0",
175175
authModes: []mdbcv1.AuthMode{"SCRAM-SHA-256"},
176176
expectError: true,
177-
expectedErrMsg: "MongoDB version must be 8.0.10 or higher",
177+
expectedErrMsg: "MongoDB version must be 8.2.0 or higher",
178178
},
179179
{
180180
name: "Valid version with invalid auth",
181-
version: "8.0.10",
181+
version: "8.2.0",
182182
authModes: []mdbcv1.AuthMode{"X509"},
183183
expectError: true,
184184
expectedErrMsg: "MongoDBSearch requires SCRAM authentication to be enabled",
@@ -188,7 +188,7 @@ func TestCommunitySearchSource_Validate(t *testing.T) {
188188
version: "7.0.0",
189189
authModes: []mdbcv1.AuthMode{"X509"},
190190
expectError: true,
191-
expectedErrMsg: "MongoDB version must be 8.0.10 or higher", // Should fail on version first
191+
expectedErrMsg: "MongoDB version must be 8.2.0 or higher", // Should fail on version first
192192
},
193193
}
194194

controllers/searchcontroller/enterprise_search_source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func (r EnterpriseResourceSearchSource) Validate() error {
5555
version, err := semver.ParseTolerant(util.StripEnt(r.Spec.GetMongoDBVersion()))
5656
if err != nil {
5757
return xerrors.Errorf("error parsing MongoDB version '%s': %w", r.Spec.GetMongoDBVersion(), err)
58-
} else if version.LT(semver.MustParse("8.0.10")) {
59-
return xerrors.New("MongoDB version must be 8.0.10 or higher")
58+
} else if version.LT(semver.MustParse("8.2.0")) {
59+
return xerrors.New("MongoDB version must be 8.2.0 or higher")
6060
}
6161

6262
if r.Spec.GetTopology() != mdbv1.ClusterTopologySingleCluster {

0 commit comments

Comments
 (0)