Skip to content

Commit 323475e

Browse files
committed
Merge branch 'master' into maciejk/ar-image-release-smoke-tests
# Conflicts: # .evergreen.yml
2 parents f8cad82 + fd4450b commit 323475e

28 files changed

+1380
-170
lines changed

.evergreen-functions.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,16 @@ functions:
222222
working_dir: src/github.com/mongodb/mongodb-kubernetes
223223
binary: scripts/evergreen/setup_docker_sbom.sh
224224

225+
helm_registry_login:
226+
command: subprocess.exec
227+
type: setup
228+
params:
229+
working_dir: src/github.com/mongodb/mongodb-kubernetes
230+
add_to_path:
231+
- ${workdir}/bin
232+
- ${PROJECT_DIR}/bin
233+
binary: scripts/release/helm_registry_login.sh
234+
225235
# Logs into all used registries
226236
configure_docker_auth: &configure_docker_auth
227237
command: subprocess.exec
@@ -494,13 +504,19 @@ functions:
494504
- rh_pyxis
495505
binary: scripts/dev/run_python.sh scripts/preflight_images.py --image ${image_name} --submit "${preflight_submit}"
496506

507+
# publish_helm_chart packages and publishes the MCK helm chart to the OCI container registry
508+
publish_helm_chart:
509+
- command: subprocess.exec
510+
params:
511+
working_dir: src/github.com/mongodb/mongodb-kubernetes
512+
binary: scripts/release/publish_helm_chart.sh
513+
497514
build_multi_cluster_binary:
498515
- command: subprocess.exec
499-
type: setup
500516
params:
501517
working_dir: src/github.com/mongodb/mongodb-kubernetes
502-
binary: scripts/evergreen/build_multi_cluster_kubeconfig_creator.sh
503-
518+
binary: scripts/dev/run_python.sh scripts/release/kubectl-mongodb/python/build_kubectl_plugin.py
519+
504520
build_and_push_appdb_database:
505521
- command: subprocess.exec
506522
params:
@@ -841,6 +857,7 @@ functions:
841857
curl -fL "${goreleaser_pro_tar_gz}" --output goreleaser_Linux_x86_64.tar.gz
842858
tar -xf goreleaser_Linux_x86_64.tar.gz
843859
chmod 755 ./goreleaser
860+
sudo cp goreleaser /usr/local/bin/
844861
845862
install_macos_notarization_service:
846863
- command: shell.exec

.evergreen.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ variables:
1515

1616
- &ops_manager_70_latest 7.0.18 # The order/index is important, since these are anchors. Please do not change
1717

18-
- &ops_manager_80_latest 8.0.14 # The order/index is important, since these are anchors. Please do not change
18+
- &ops_manager_80_latest 8.0.15 # The order/index is important, since these are anchors. Please do not change
1919

2020
# The dependency unification between static and non-static is intentional here.
2121
# Even though some images are exclusive, in EVG they all are built once and in parallel.
@@ -82,6 +82,7 @@ variables:
8282
- func: clone
8383
- func: switch_context
8484
- func: setup_building_host_minikube
85+
- func: install_goreleaser
8586
- func: build_multi_cluster_binary
8687

8788
- &setup_group_multi_cluster
@@ -91,6 +92,7 @@ variables:
9192
- func: download_kube_tools
9293
- func: switch_context
9394
- func: setup_building_host
95+
- func: install_goreleaser
9496
- func: build_multi_cluster_binary
9597

9698
- &setup_and_teardown_task_cloudqa
@@ -349,6 +351,7 @@ tasks:
349351
commands:
350352
- func: clone
351353
- func: setup_building_host
354+
- func: install_goreleaser
352355
- func: build_multi_cluster_binary
353356
- func: pipeline
354357
vars:
@@ -358,6 +361,7 @@ tasks:
358361
commands:
359362
- func: clone
360363
- func: setup_building_host
364+
- func: install_goreleaser
361365
- func: build_multi_cluster_binary
362366
- func: pipeline
363367
vars:
@@ -370,6 +374,7 @@ tasks:
370374
vars:
371375
skip_minikube_setup: true
372376
skip_install_python_requirements: false
377+
- func: install_goreleaser
373378
- func: build_multi_cluster_binary
374379
- func: pipeline
375380
vars:
@@ -382,6 +387,7 @@ tasks:
382387
vars:
383388
skip_minikube_setup: true
384389
skip_install_python_requirements: false
390+
- func: install_goreleaser
385391
- func: build_multi_cluster_binary
386392
- func: pipeline
387393
vars:
@@ -434,7 +440,7 @@ tasks:
434440
- func: quay_login
435441
- func: pipeline_agent
436442
vars:
437-
FLAGS: "--current-agents"
443+
FLAGS: "--all-agents"
438444

439445
- name: build_init_database_image_ubi
440446
commands:
@@ -464,6 +470,16 @@ tasks:
464470
- func: setup_building_host
465471
- func: pipeline_version_upgrade_hook
466472

473+
- name: publish_helm_chart
474+
commands:
475+
- func: clone
476+
- func: python_venv
477+
- func: setup_kubectl
478+
- func: setup_aws
479+
- func: prepare_aws
480+
- func: helm_registry_login
481+
- func: publish_helm_chart
482+
467483
- name: prepare_aws
468484
priority: 59
469485
commands:
@@ -1699,6 +1715,7 @@ buildvariants:
16991715
- name: build_readiness_probe_image
17001716
- name: build_version_upgrade_hook_image
17011717
- name: prepare_aws
1718+
- name: publish_helm_chart
17021719

17031720
- name: init_test_run_ibm_power
17041721
display_name: init_test_run_ibm_power

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,6 @@ docs/**/test.sh.run.log
9393
dist
9494
logs
9595
*.run.log
96+
97+
# locally packaged chart
98+
mongodb-kubernetes-*.tgz

.goreleaser.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ builds:
1414
goarch:
1515
- amd64
1616
- arm64
17+
- s390x
18+
- ppc64le
1719
hooks:
1820
# This will notarize Apple binaries and replace goreleaser bins with the notarized ones
1921
post:

api/v1/mdb/mongodb_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ func (a *Authentication) IsOIDCEnabled() bool {
10381038
return stringutil.Contains(a.GetModes(), util.OIDC)
10391039
}
10401040

1041-
// GetModes returns the modes of the Authentication instance of an empty
1041+
// GetModes returns the modes of the Authentication instance, or an empty
10421042
// list if it is nil
10431043
func (a *Authentication) GetModes() []string {
10441044
if a == nil {

build_info.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,14 @@
419419
"binaries": {
420420
"kubectl-mongodb": {
421421
"patch": {
422-
"s3-store": "s3://kubectl-mongodb/dev",
422+
"s3-store": "mongodb-kubernetes-dev",
423423
"platforms": [
424424
"linux/amd64"
425425
]
426426
},
427427
"staging": {
428-
"sign": true,
429-
"s3-store": "s3://kubectl-mongodb/staging",
428+
"sign": false,
429+
"s3-store": "mongodb-kubernetes-staging",
430430
"platforms": [
431431
"darwin/amd64",
432432
"darwin/arm64",
@@ -436,7 +436,7 @@
436436
},
437437
"release": {
438438
"sign": true,
439-
"s3-store": "s3://kubectl-mongodb/prod",
439+
"s3-store": "mongodb-kubernetes-release",
440440
"platforms": [
441441
"darwin/amd64",
442442
"darwin/arm64",
@@ -449,15 +449,20 @@
449449
"helm-charts": {
450450
"mongodb-kubernetes": {
451451
"patch": {
452-
"repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/helm-charts"]
452+
"registry": "268558157000.dkr.ecr.us-east-1.amazonaws.com",
453+
"region": "us-east-1",
454+
"repository": "dev/mongodb/helm-charts"
453455
},
454456
"staging": {
455457
"sign": true,
456-
"repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/helm-charts"]
458+
"registry": "268558157000.dkr.ecr.us-east-1.amazonaws.com",
459+
"region": "us-east-1",
460+
"repository": "staging/mongodb/helm-charts"
457461
},
458462
"release": {
459463
"sign": true,
460-
"repositories": ["quay.io/mongodb/helm-charts"]
464+
"registry": "quay.io",
465+
"repository": "mongodb/helm-charts"
461466
}
462467
}
463468
}

config/manager/manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ spec:
148148
value: "quay.io/mongodb/mongodb-agent:108.0.12.8846-1"
149149
- name: RELATED_IMAGE_AGENT_IMAGE_108_0_13_8870_1
150150
value: "quay.io/mongodb/mongodb-agent:108.0.13.8870-1"
151+
- name: RELATED_IMAGE_AGENT_IMAGE_108_0_15_8888_1
152+
value: "quay.io/mongodb/mongodb-agent:108.0.15.8888-1"
151153
- name: RELATED_IMAGE_AGENT_IMAGE_108_0_2_8729_1
152154
value: "quay.io/mongodb/mongodb-agent:108.0.2.8729-1"
153155
- name: RELATED_IMAGE_AGENT_IMAGE_108_0_3_8758_1
@@ -204,6 +206,8 @@ spec:
204206
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.13"
205207
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_14
206208
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.14"
209+
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_15
210+
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.15"
207211
# since the official server images end with a different suffix we can re-use the same $mongodbImageEnv
208212
- name: RELATED_IMAGE_MONGODB_IMAGE_4_4_0_ubi8
209213
value: "quay.io/mongodb/mongodb-enterprise-server:4.4.0-ubi8"

controllers/om/process/om_process.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ func CreateMongodProcessesWithLimit(mongoDBImage string, forceEnterprise bool, s
2222
return processes
2323
}
2424

25+
// CreateMongodProcessesFromMongoDB creates mongod processes directly from MongoDB resource without StatefulSet
26+
func CreateMongodProcessesFromMongoDB(mongoDBImage string, forceEnterprise bool, mdb *mdbv1.MongoDB, limit int, fcv string, tlsCertPath string) []om.Process {
27+
hostnames, names := dns.GetDNSNames(mdb.Name, mdb.ServiceName(), mdb.Namespace, mdb.Spec.GetClusterDomain(), limit, mdb.Spec.DbCommonSpec.GetExternalDomain())
28+
processes := make([]om.Process, len(hostnames))
29+
30+
for idx, hostname := range hostnames {
31+
processes[idx] = om.NewMongodProcess(names[idx], hostname, mongoDBImage, forceEnterprise, mdb.Spec.GetAdditionalMongodConfig(), &mdb.Spec, tlsCertPath, mdb.Annotations, fcv)
32+
}
33+
34+
return processes
35+
}
36+
2537
// CreateMongodProcessesWithLimitMulti creates the process array for automationConfig based on MultiCluster CR spec
2638
func CreateMongodProcessesWithLimitMulti(mongoDBImage string, forceEnterprise bool, mrs mdbmultiv1.MongoDBMultiCluster, certFileName string) ([]om.Process, error) {
2739
hostnames := make([]string, 0)
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
package process
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
9+
mdbv1 "github.com/mongodb/mongodb-kubernetes/api/v1/mdb"
10+
"github.com/mongodb/mongodb-kubernetes/pkg/util/maputil"
11+
)
12+
13+
const (
14+
defaultMongoDBImage = "mongodb/mongodb-enterprise-server:7.0.0"
15+
defaultFCV = "7.0"
16+
defaultNamespace = "test-namespace"
17+
)
18+
19+
func TestCreateMongodProcessesFromMongoDB(t *testing.T) {
20+
t.Run("Happy path - creates processes with correct integration", func(t *testing.T) {
21+
mdb := baseReplicaSet("test-rs", 3)
22+
processes := CreateMongodProcessesFromMongoDB(
23+
defaultMongoDBImage,
24+
false,
25+
mdb,
26+
3,
27+
defaultFCV,
28+
"",
29+
)
30+
31+
assert.Len(t, processes, 3, "Should create 3 processes")
32+
33+
// Verify basic integration - processes are created with correct names and FCV
34+
for i, process := range processes {
35+
expectedName := fmt.Sprintf("test-rs-%d", i)
36+
assert.Equal(t, expectedName, process.Name(), "Process name should be generated correctly")
37+
assert.Equal(t, defaultFCV, process.FeatureCompatibilityVersion(), "FCV should be set correctly")
38+
assert.NotEmpty(t, process.HostName(), "Hostname should be generated")
39+
}
40+
})
41+
42+
t.Run("Limit parameter controls process count", func(t *testing.T) {
43+
mdb := baseReplicaSet("scale-rs", 5)
44+
45+
// Test limit less than members (scale up in progress)
46+
processesScaleUp := CreateMongodProcessesFromMongoDB(
47+
defaultMongoDBImage,
48+
false,
49+
mdb,
50+
3, // limit
51+
defaultFCV,
52+
"",
53+
)
54+
assert.Len(t, processesScaleUp, 3, "Limit should control process count during scale up")
55+
56+
// Test limit greater than members (scale down in progress)
57+
processesScaleDown := CreateMongodProcessesFromMongoDB(
58+
defaultMongoDBImage,
59+
false,
60+
mdb,
61+
7, // limit
62+
defaultFCV,
63+
"",
64+
)
65+
assert.Len(t, processesScaleDown, 7, "Limit should control process count during scale down")
66+
67+
// Test limit zero
68+
processesZero := CreateMongodProcessesFromMongoDB(
69+
defaultMongoDBImage,
70+
false,
71+
mdb,
72+
0, // limit
73+
defaultFCV,
74+
"",
75+
)
76+
assert.Empty(t, processesZero, "Zero limit should create empty process slice")
77+
})
78+
79+
t.Run("TLS cert path flows through to processes", func(t *testing.T) {
80+
mdb := baseReplicaSet("tls-rs", 2)
81+
mdb.Spec.Security = &mdbv1.Security{
82+
TLSConfig: &mdbv1.TLSConfig{Enabled: true},
83+
}
84+
85+
tlsCertPath := "/custom/path/to/cert.pem"
86+
processes := CreateMongodProcessesFromMongoDB(
87+
defaultMongoDBImage,
88+
false,
89+
mdb,
90+
2,
91+
defaultFCV,
92+
tlsCertPath,
93+
)
94+
95+
assert.Len(t, processes, 2)
96+
97+
// Verify TLS configuration is properly integrated
98+
for i, process := range processes {
99+
tlsConfig := process.TLSConfig()
100+
assert.NotNil(t, tlsConfig, "TLS config should be set when cert path provided")
101+
assert.Equal(t, tlsCertPath, tlsConfig["certificateKeyFile"], "TLS cert path should match at index %d", i)
102+
}
103+
})
104+
}
105+
106+
func TestCreateMongodProcessesFromMongoDB_AdditionalConfig(t *testing.T) {
107+
config := mdbv1.NewAdditionalMongodConfig("storage.engine", "inMemory").
108+
AddOption("replication.oplogSizeMB", 2048)
109+
110+
mdb := mdbv1.NewReplicaSetBuilder().
111+
SetName("config-rs").
112+
SetNamespace(defaultNamespace).
113+
SetMembers(2).
114+
SetVersion("7.0.0").
115+
SetFCVersion(defaultFCV).
116+
SetAdditionalConfig(config).
117+
Build()
118+
119+
processes := CreateMongodProcessesFromMongoDB(
120+
defaultMongoDBImage,
121+
false,
122+
mdb,
123+
2,
124+
defaultFCV,
125+
"",
126+
)
127+
128+
assert.Len(t, processes, 2)
129+
130+
for i, process := range processes {
131+
assert.Equal(t, "inMemory", maputil.ReadMapValueAsInterface(process.Args(), "storage", "engine"),
132+
"Storage engine mismatch at index %d", i)
133+
assert.Equal(t, 2048, maputil.ReadMapValueAsInterface(process.Args(), "replication", "oplogSizeMB"),
134+
"OplogSizeMB mismatch at index %d", i)
135+
}
136+
}
137+
138+
func baseReplicaSet(name string, members int) *mdbv1.MongoDB {
139+
return mdbv1.NewReplicaSetBuilder().
140+
SetName(name).
141+
SetNamespace(defaultNamespace).
142+
SetMembers(members).
143+
SetVersion("7.0.0").
144+
SetFCVersion(defaultFCV).
145+
Build()
146+
}

0 commit comments

Comments
 (0)