Skip to content

Commit d2497e2

Browse files
committed
Handle new mongot config schema
1 parent 4aca390 commit d2497e2

File tree

9 files changed

+95
-40
lines changed

9 files changed

+95
-40
lines changed

config/manager/manager.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ spec:
392392
- name: RELATED_IMAGE_MONGODB_IMAGE_8_0_0_ubi9
393393
value: "quay.io/mongodb/mongodb-enterprise-server:8.0.0-ubi9"
394394
- name: RELATED_IMAGE_MDB_SEARCH_IMAGE_1_47_0
395-
value: "quay.io/mongodb/mongodb-search-community:1.47.0"
395+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-search-community:1.47.0"
396396
- name: MDB_SEARCH_COMMUNITY_REPO_URL
397-
value: "quay.io/mongodb"
397+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev"
398398
- name: MDB_SEARCH_COMMUNITY_NAME
399399
value: "mongodb-search-community"
400400
- name: MDB_SEARCH_COMMUNITY_VERSION

controllers/search_controller/mongodbsearch_reconcile_helper.go

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,42 @@ func buildSearchHeadlessService(search *searchv1.MongoDBSearch) corev1.Service {
207207
}
208208

209209
func createMongotConfig(search *searchv1.MongoDBSearch, db SearchSourceDBResource) mongot.Config {
210-
return mongot.Config{CommunityPrivatePreview: mongot.CommunityPrivatePreview{
211-
MongodHostAndPort: fmt.Sprintf("%s.%s.svc.cluster.local:%d", db.DatabaseServiceName(), db.GetNamespace(), db.DatabasePort()),
212-
QueryServerAddress: fmt.Sprintf("localhost:%d", search.GetMongotPort()),
213-
KeyFilePath: "/mongot/keyfile/keyfile",
214-
DataPath: "/mongot/data/config.yml",
215-
Metrics: mongot.Metrics{
210+
return mongot.Config{
211+
SyncSource: mongot.ConfigSyncSource{
212+
ReplicaSet: mongot.ConfigReplicaSet{
213+
HostAndPort: fmt.Sprintf("%s.%s.svc.cluster.local:%d", db.DatabaseServiceName(), db.GetNamespace(), db.DatabasePort()),
214+
Username: "__system",
215+
PasswordFile: "/tmp/keyfile",
216+
TLS: false,
217+
// TODO check
218+
ReadPreference: "secondaryPreferred",
219+
},
220+
},
221+
Storage: mongot.ConfigStorage{
222+
DataPath: "/mongot/data/config.yml",
223+
},
224+
Server: mongot.ConfigServer{
225+
Wireproto: mongot.ConfigWireproto{
226+
Address: "0.0.0.0:27027",
227+
Authentication: mongot.ConfigAuthentication{
228+
Mode: "keyfile",
229+
KeyFile: "/tmp/keyfile",
230+
},
231+
TLS: mongot.ConfigTLS{Mode: "disabled"},
232+
},
233+
},
234+
Metrics: mongot.ConfigMetrics{
216235
Enabled: true,
217236
Address: fmt.Sprintf("localhost:%d", search.GetMongotMetricsPort()),
218237
},
219-
Logging: mongot.Logging{
238+
HealthCheck: mongot.ConfigHealthCheck{
239+
Address: "0.0.0.0:8080",
240+
},
241+
Logging: mongot.ConfigLogging{
220242
Verbosity: "DEBUG",
243+
LogPath: nil,
221244
},
222-
}}
245+
}
223246
}
224247

225248
func GetMongodConfigParameters(search *searchv1.MongoDBSearch) map[string]interface{} {

controllers/search_controller/search_construction.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ func mongodbSearchContainer(mdbSearch *searchv1.MongoDBSearch, volumeMounts []co
180180
container.WithCommand([]string{"sh"}),
181181
container.WithArgs([]string{
182182
"-c",
183-
"/mongot-community/mongot --config /mongot/config/config.yml",
183+
`
184+
cp /mongot/keyfile/keyfile /tmp/keyfile
185+
chown 2000:2000 /tmp/keyfile
186+
chmod 0600 /tmp/keyfile
187+
/mongot-community/mongot --config /mongot/config/config.yml
188+
`,
184189
}),
185190
containerSecurityContext,
186191
)

helm_chart/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ community:
225225
search:
226226
community:
227227
# Full Search container image url used for the MongoDB Community Search container will be constructed as {search.community.repo}/{search.community.name}:{search.community.version}
228-
repo: quay.io/mongodb
228+
# repo: quay.io/mongodb
229+
# name: mongodb-search-community
230+
# # default MongoDB Search version used; can be overridden by setting MongoDBSearch.spec.version field.
231+
# version: 1.47.0
232+
repo: 268558157000.dkr.ecr.us-east-1.amazonaws.com/dev
229233
name: mongodb-search-community
230234
# default MongoDB Search version used; can be overridden by setting MongoDBSearch.spec.version field.
231235
version: 1.47.0
Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,59 @@
11
package mongot
22

33
type Config struct {
4-
CommunityPrivatePreview CommunityPrivatePreview `json:"communityPrivatePreview"`
4+
SyncSource ConfigSyncSource `json:"syncSource"`
5+
Storage ConfigStorage `json:"storage"`
6+
Server ConfigServer `json:"server"`
7+
Metrics ConfigMetrics `json:"metrics"`
8+
HealthCheck ConfigHealthCheck `json:"healthCheck"`
9+
Logging ConfigLogging `json:"logging"`
510
}
611

7-
// CommunityPrivatePreview structure reflects private preview configuration from mongot:
8-
// https://github.com/10gen/mongot/blob/060ec179af062ac2639678f4a613b8ab02c21597/src/main/java/com/xgen/mongot/config/provider/community/CommunityConfig.java#L100
9-
// Comments are from the default config file: https://github.com/10gen/mongot/blob/375379e56a580916695a2f53e12fd4a99aa24f0b/deploy/community-resources/config.default.yml#L1-L0
10-
type CommunityPrivatePreview struct {
11-
// Socket (IPv4/6) address of the sync source mongod
12-
MongodHostAndPort string `json:"mongodHostAndPort"`
13-
14-
// Socket (IPv4/6) address on which to listen for wire protocol connections
15-
QueryServerAddress string `json:"queryServerAddress"`
12+
type ConfigSyncSource struct {
13+
ReplicaSet ConfigReplicaSet `json:"replicaSet"`
14+
}
1615

17-
// Keyfile used for mongod -> mongot authentication
18-
KeyFilePath string `json:"keyFilePath"`
16+
type ConfigReplicaSet struct {
17+
HostAndPort string `json:"hostAndPort"`
18+
Username string `json:"username"`
19+
PasswordFile string `json:"passwordFile"`
20+
TLS bool `json:"tls"`
21+
ReadPreference string `json:"readPreference"`
22+
}
1923

20-
// Filesystem path that all mongot data will be stored at
24+
type ConfigStorage struct {
2125
DataPath string `json:"dataPath"`
26+
}
2227

23-
// Options for metrics
24-
Metrics Metrics `json:"metrics,omitempty"`
28+
type ConfigServer struct {
29+
Wireproto ConfigWireproto `json:"wireproto"`
30+
}
2531

26-
// Options for logging
27-
Logging Logging `json:"logging,omitempty"`
32+
type ConfigWireproto struct {
33+
Address string `json:"address"`
34+
Authentication ConfigAuthentication `json:"authentication"`
35+
TLS ConfigTLS `json:"tls"`
2836
}
2937

30-
type Metrics struct {
31-
// Whether to enable the Prometheus metrics endpoint
32-
Enabled bool `json:"enabled"`
38+
type ConfigAuthentication struct {
39+
Mode string `json:"mode"`
40+
KeyFile string `json:"keyFile"`
41+
}
42+
43+
type ConfigTLS struct {
44+
Mode string `json:"mode"`
45+
}
46+
47+
type ConfigMetrics struct {
48+
Enabled bool `json:"enabled"`
49+
Address string `json:"address"`
50+
}
3351

34-
// Socket address (IPv4/6) on which the Prometheus /metrics endpoint will be exposed
52+
type ConfigHealthCheck struct {
3553
Address string `json:"address"`
3654
}
3755

38-
type Logging struct {
39-
// Log level
40-
Verbosity string `json:"verbosity"`
56+
type ConfigLogging struct {
57+
Verbosity string `json:"verbosity"`
58+
LogPath *string `json:"logPath,omitempty"`
4159
}

public/mongodb-kubernetes-multi-cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ spec:
410410
value: "ubi8"
411411
# Community Env Vars End
412412
- name: MDB_SEARCH_COMMUNITY_REPO_URL
413-
value: "quay.io/mongodb"
413+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev"
414414
- name: MDB_SEARCH_COMMUNITY_NAME
415415
value: "mongodb-search-community"
416416
- name: MDB_SEARCH_COMMUNITY_VERSION

public/mongodb-kubernetes-openshift.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,9 @@ spec:
674674
- name: RELATED_IMAGE_MONGODB_IMAGE_8_0_0_ubi9
675675
value: "quay.io/mongodb/mongodb-enterprise-server:8.0.0-ubi9"
676676
- name: RELATED_IMAGE_MDB_SEARCH_IMAGE_1_47_0
677-
value: "quay.io/mongodb/mongodb-search-community:1.47.0"
677+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-search-community:1.47.0"
678678
- name: MDB_SEARCH_COMMUNITY_REPO_URL
679-
value: "quay.io/mongodb"
679+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev"
680680
- name: MDB_SEARCH_COMMUNITY_NAME
681681
value: "mongodb-search-community"
682682
- name: MDB_SEARCH_COMMUNITY_VERSION

public/mongodb-kubernetes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ spec:
406406
value: "ubi8"
407407
# Community Env Vars End
408408
- name: MDB_SEARCH_COMMUNITY_REPO_URL
409-
value: "quay.io/mongodb"
409+
value: "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev"
410410
- name: MDB_SEARCH_COMMUNITY_NAME
411411
value: "mongodb-search-community"
412412
- name: MDB_SEARCH_COMMUNITY_VERSION

scripts/dev/contexts/e2e_mdb_community

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ source "${script_dir}/variables/mongodb_latest"
1010

1111
# This variable is needed otherwise the `fetch_om_information.sh` script is called and fails the test
1212
export OM_EXTERNALLY_CONFIGURED="true"
13+
14+
# Temporary development images built from mongot master
15+
export MDB_SEARCH_COMMUNITY_VERSION="776d43523d185b6b234289e17c191712a3e6569b"
16+
export MDB_SEARCH_COMMUNITY_NAME="mongot/community"
17+
export MDB_SEARCH_COMMUNITY_REPO_URL="268558157000.dkr.ecr.eu-west-1.amazonaws.com"

0 commit comments

Comments
 (0)