Skip to content

Commit 1c8f00e

Browse files
committed
Merge branch 'master' into e2e-tests-on-published-chart
# Conflicts: # docker/mongodb-kubernetes-tests/kubetester/helm.py # docker/mongodb-kubernetes-tests/kubetester/operator.py # docker/mongodb-kubernetes-tests/tests/conftest.py
2 parents cfee047 + 54a17fe commit 1c8f00e

File tree

140 files changed

+893
-3791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+893
-3791
lines changed

.evergreen-functions.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ variables:
4949
- READINESS_PROBE_VERSION
5050
- VERSION_UPGRADE_HOOK_VERSION
5151
- BUILD_SCENARIO
52+
- MDB_BASH_DEBUG
5253

5354
functions:
5455

@@ -523,6 +524,8 @@ functions:
523524
download_multi_cluster_binary:
524525
- command: subprocess.exec
525526
params:
527+
include_expansions_in_env:
528+
- workdir
526529
working_dir: src/github.com/mongodb/mongodb-kubernetes
527530
binary: scripts/release/kubectl_mongodb/download_kubectl_plugin.sh
528531
env:
@@ -769,18 +772,14 @@ functions:
769772
#
770773
# Code snippet test automation
771774
#
772-
773-
sample_commit_output:
774-
- command: github.generate_token
775-
params:
776-
expansion_name: GH_TOKEN
775+
archive_snippets_output:
777776
- command: subprocess.exec
778777
params:
779778
include_expansions_in_env:
780779
- GH_TOKEN
781-
- code_snippets_commit_output
780+
- MDB_BASH_DEBUG
782781
working_dir: src/github.com/mongodb/mongodb-kubernetes
783-
binary: scripts/code_snippets/sample_commit_output.sh
782+
binary: scripts/code_snippets/archive_snippets_output.sh
784783

785784
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
786785
test_code_snippets:
@@ -793,6 +792,9 @@ functions:
793792
- code_snippets_teardown
794793
- code_snippets_reset
795794
- task_name
795+
- MDB_BASH_DEBUG
796+
add_to_path:
797+
- ${workdir}/bin
796798
script: |
797799
./scripts/code_snippets/tests/${task_name}
798800

.evergreen-snippets.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,19 @@ functions:
6969
permissions: private
7070
visibility: signed
7171
content_type: text/plain
72-
- command: s3.put
73-
params:
74-
aws_key: ${enterprise_aws_access_key_id}
75-
aws_secret: ${enterprise_aws_secret_access_key}
76-
local_files_include_filter:
77-
- src/github.com/mongodb/mongodb-kubernetes/public/architectures/**/*.out
78-
- src/github.com/mongodb/mongodb-kubernetes/docs/**/*.out
79-
preserve_path: true
80-
remote_file: logs/${task_id}/${execution}/
81-
bucket: operator-e2e-artifacts
82-
permissions: private
83-
visibility: signed
84-
content_type: text/plain
8572

8673
upload_code_snippets_outputs:
8774
- command: s3.put
8875
params:
8976
aws_key: ${enterprise_aws_access_key_id}
9077
aws_secret: ${enterprise_aws_secret_access_key}
9178
local_files_include_filter:
92-
- snippets_outputs.tgz
93-
remote_file: logs/${task_id}/${execution}/
79+
- snippets_outputs*.tgz
80+
remote_file: snippets_outputs/${version_id}
9481
bucket: operator-e2e-artifacts
9582
permissions: private
9683
visibility: signed
9784
content_type: ${content_type|application/x-gzip}
98-
display_name: "Snippets Outputs"
9985

10086
tasks:
10187
# Code snippets tasks
@@ -106,31 +92,31 @@ tasks:
10692
tags: [ "code_snippets" ]
10793
commands:
10894
- func: test_code_snippets
109-
- func: sample_commit_output
95+
- func: archive_snippets_output
11096

11197
- name: test_gke_multi_cluster_no_mesh_snippets.sh
11298
tags: [ "code_snippets" ]
11399
commands:
114100
- func: test_code_snippets
115-
- func: sample_commit_output
101+
- func: archive_snippets_output
116102

117103
- name: test_kind_search_community_snippets.sh
118104
tags: [ "code_snippets", "patch-run" ]
119105
commands:
120106
- func: test_code_snippets
121-
- func: sample_commit_output
107+
- func: archive_snippets_output
122108

123109
- name: test_kind_search_enterprise_snippets.sh
124110
tags: [ "code_snippets", "patch-run" ]
125111
commands:
126112
- func: test_code_snippets
127-
- func: sample_commit_output
113+
- func: archive_snippets_output
128114

129115
- name: test_kind_search_external_mongod_snippets.sh
130116
tags: [ "code_snippets", "patch-run" ]
131117
commands:
132118
- func: test_code_snippets
133-
- func: sample_commit_output
119+
- func: archive_snippets_output
134120

135121
task_groups:
136122
- name: gke_code_snippets_task_group

.evergreen-tasks.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,25 @@ tasks:
6666
tags: [ "code_snippets" ]
6767
commands:
6868
- func: test_code_snippets
69-
- func: sample_commit_output
69+
- func: archive_snippets_output
7070

7171
- name: task_gke_multi_cluster_no_mesh_snippets
7272
tags: [ "code_snippets" ]
7373
commands:
7474
- func: test_code_snippets
75-
- func: sample_commit_output
75+
- func: archive_snippets_output
7676

7777
- name: task_kind_search_community_snippets
7878
tags: [ "code_snippets", "patch-run" ]
7979
commands:
8080
- func: test_code_snippets
81-
- func: sample_commit_output
81+
- func: archive_snippets_output
8282

8383
- name: task_kind_search_enterprise_snippets
8484
tags: [ "code_snippets", "patch-run" ]
8585
commands:
8686
- func: test_code_snippets
87-
- func: sample_commit_output
87+
- func: archive_snippets_output
8888

8989
## Below are only e2e runs for .evergreen.yml ##
9090

@@ -1307,3 +1307,8 @@ tasks:
13071307
tags: [ "patch-run" ]
13081308
commands:
13091309
- func: "e2e_test"
1310+
1311+
- name: e2e_search_enterprise_x509_cluster_auth
1312+
tags: [ "patch-run" ]
1313+
commands:
1314+
- func: "e2e_test"

.evergreen.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ parameters:
203203
value: "false"
204204
description: set this to true if you would like to delete the resources created in the code snippet tests, but keep the clusters
205205

206-
- key: code_snippets_commit_output
207-
value: "false"
208-
description: set this to true if you would like the pipeline to automatically push a branch with updated snippets outputs
206+
- key: MDB_BASH_DEBUG
207+
value: "0"
208+
description: set this to 1 if you want shell scripts to enable set -x
209209

210210
# Triggered manually or by PCT.
211211
patch_aliases:
@@ -770,6 +770,7 @@ task_groups:
770770
# MongoDBSearch test group
771771
- e2e_search_enterprise_basic
772772
- e2e_search_enterprise_tls
773+
- e2e_search_enterprise_x509_cluster_auth
773774
<<: *teardown_group
774775

775776
# this task group contains just a one task, which is smoke testing whether the operator
@@ -1202,6 +1203,7 @@ task_groups:
12021203
<<: *setup_and_teardown_task
12031204
tasks:
12041205
- e2e_search_enterprise_tls
1206+
- e2e_search_enterprise_x509_cluster_auth
12051207
<<: *teardown_group
12061208

12071209
# Tests features only supported on OM70 and OM80, its only upgrade test as we test upgrading from 6 to 7 or 7 to 8
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
kind: feature
3+
date: 2025-11-03
4+
---
5+
6+
* **MongoDBSearch**: MongoDB deployments using X509 internal cluster authentication are now supported. Previously MongoDB Search required SCRAM authentication among members of a MongoDB replica set. Note: SCRAM client authentication is still required, this change merely relaxes the requirements on internal cluster authentication.
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
kind: feature
3+
date: 2025-11-06
4+
---
5+
6+
* **MongoDBSearch**: Updated the default `mongodb/mongodb-search` image version to 0.55.0. This is the version MCK uses if `.spec.version` is not specified.

config/manager/manager.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ spec:
162162
value: "quay.io/mongodb/mongodb-agent:108.0.7.8810-1"
163163
- name: RELATED_IMAGE_AGENT_IMAGE_12_0_35_7911_1
164164
value: "quay.io/mongodb/mongodb-agent:12.0.35.7911-1"
165-
- name: RELATED_IMAGE_AGENT_IMAGE_13_41_0_9830_1
166-
value: "quay.io/mongodb/mongodb-agent:13.41.0.9830-1"
165+
- name: RELATED_IMAGE_AGENT_IMAGE_13_42_0_9892_1
166+
value: "quay.io/mongodb/mongodb-agent:13.42.0.9892-1"
167167
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_26
168168
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:6.0.26"
169169
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_27
@@ -307,11 +307,11 @@ spec:
307307
value: "quay.io/mongodb/mongodb-enterprise-server:8.0.0-ubi8"
308308
- name: RELATED_IMAGE_MONGODB_IMAGE_8_0_0_ubi9
309309
value: "quay.io/mongodb/mongodb-enterprise-server:8.0.0-ubi9"
310-
- name: RELATED_IMAGE_MDB_SEARCH_IMAGE_0_53_1
311-
value: "quay.io/mongodb/mongodb-search:0.53.1"
310+
- name: RELATED_IMAGE_MDB_SEARCH_IMAGE_0_55_0
311+
value: "quay.io/mongodb/mongodb-search:0.55.0"
312312
- name: MDB_SEARCH_REPO_URL
313313
value: "quay.io/mongodb"
314314
- name: MDB_SEARCH_NAME
315315
value: "mongodb-search"
316316
- name: MDB_SEARCH_VERSION
317-
value: "0.53.1"
317+
value: "0.55.0"

controllers/operator/common_controller_test.go

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,98 @@ func TestDontSendNilPrivileges(t *testing.T) {
406406
assert.NotNil(t, roles[0].Privileges)
407407
}
408408

409+
func TestCheckEmptyStringsInPrivilegesEquivalentToNotPassingFields(t *testing.T) {
410+
ctx := context.Background()
411+
412+
roleWithEmptyStrings := mdbv1.MongoDBRole{
413+
Role: "withEmptyStrings",
414+
Db: "admin",
415+
Roles: []mdbv1.InheritedRole{{
416+
Db: "admin",
417+
Role: "read",
418+
}},
419+
Privileges: []mdbv1.Privilege{
420+
{
421+
Resource: mdbv1.Resource{
422+
Db: "config",
423+
Collection: "", // Explicit empty string
424+
},
425+
Actions: []string{"find", "update", "insert", "remove"},
426+
},
427+
{
428+
Resource: mdbv1.Resource{
429+
Db: "users",
430+
Collection: "usersCollection",
431+
},
432+
Actions: []string{"update", "insert", "remove"},
433+
},
434+
{
435+
Resource: mdbv1.Resource{
436+
Db: "", // Explicit empty string
437+
Collection: "", // Explicit empty string
438+
},
439+
Actions: []string{"find"},
440+
},
441+
},
442+
}
443+
444+
// Role without empty strings (fields omitted, which should result in empty strings for string types)
445+
roleWithoutEmptyStrings := mdbv1.MongoDBRole{
446+
Role: "withoutEmptyFields",
447+
Db: "admin",
448+
Roles: []mdbv1.InheritedRole{{
449+
Db: "admin",
450+
Role: "read",
451+
}},
452+
Privileges: []mdbv1.Privilege{
453+
{
454+
Resource: mdbv1.Resource{
455+
Db: "config",
456+
// field not set, should pass ""
457+
},
458+
Actions: []string{"find", "update", "insert", "remove"},
459+
},
460+
{
461+
Resource: mdbv1.Resource{
462+
Db: "users",
463+
Collection: "usersCollection",
464+
},
465+
Actions: []string{"update", "insert", "remove"},
466+
},
467+
{
468+
Resource: mdbv1.Resource{
469+
// fields not set, should be passed as empty strings
470+
},
471+
Actions: []string{"find"},
472+
},
473+
},
474+
}
475+
476+
rs := DefaultReplicaSetBuilder().SetRoles([]mdbv1.MongoDBRole{roleWithEmptyStrings, roleWithoutEmptyStrings}).Build()
477+
kubeClient, omConnectionFactory := mock.NewDefaultFakeClient()
478+
controller := NewReconcileCommonController(ctx, kubeClient)
479+
mockOm, _ := prepareConnection(ctx, controller, omConnectionFactory.GetConnectionFunc, t)
480+
481+
controller.ensureRoles(ctx, rs.Spec.DbCommonSpec, true, mockOm, kube.ObjectKeyFromApiObject(rs), zap.S())
482+
483+
ac, err := mockOm.ReadAutomationConfig()
484+
assert.NoError(t, err)
485+
roles, ok := ac.Deployment["roles"].([]mdbv1.MongoDBRole)
486+
assert.True(t, ok)
487+
require.Len(t, roles, 2)
488+
489+
assert.Equal(t, "config", roles[0].Privileges[0].Resource.Db)
490+
assert.Equal(t, "", roles[0].Privileges[0].Resource.Collection)
491+
492+
assert.Equal(t, "users", roles[0].Privileges[1].Resource.Db)
493+
assert.Equal(t, "usersCollection", roles[0].Privileges[1].Resource.Collection)
494+
495+
assert.Equal(t, "", roles[0].Privileges[2].Resource.Db)
496+
assert.Equal(t, "", roles[0].Privileges[2].Resource.Collection)
497+
498+
assert.True(t, reflect.DeepEqual(roles[0].Privileges, roles[1].Privileges))
499+
}
500+
409501
func TestSecretWatcherWithAllResources(t *testing.T) {
410502
ctx := context.Background()
411503
caName := "custom-ca"

controllers/searchcontroller/enterprise_search_source.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,5 @@ func (r EnterpriseResourceSearchSource) Validate() error {
8181
return xerrors.New("MongoDBSearch requires SCRAM authentication to be enabled")
8282
}
8383

84-
if r.Spec.Security.GetInternalClusterAuthenticationMode() == util.X509 {
85-
return xerrors.New("MongoDBSearch does not support X.509 internal cluster authentication")
86-
}
87-
8884
return nil
8985
}

controllers/searchcontroller/enterprise_search_source_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ func TestEnterpriseResourceSearchSource_Validate(t *testing.T) {
223223
resourceType: mdbv1.ReplicaSet,
224224
authModes: []string{"SCRAM-SHA-256"},
225225
internalClusterAuth: "X509",
226-
expectError: true,
227-
expectedErrMsg: "MongoDBSearch does not support X.509 internal cluster authentication",
226+
expectError: false,
228227
},
229228
{
230229
name: "Valid internal cluster auth - empty",

0 commit comments

Comments
 (0)