Skip to content

Commit f1d9e3c

Browse files
committed
Search: snippets
1 parent b292b51 commit f1d9e3c

File tree

75 files changed

+4023
-6
lines changed

Some content is hidden

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

75 files changed

+4023
-6
lines changed

.evergreen-snippets.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ tasks:
121121
- func: test_code_snippets
122122
- func: archive_snippets_output
123123

124+
- name: test_kind_search_sharded_enterprise_external_lb_snippets.sh
125+
tags: [ "code_snippets", "patch-run" ]
126+
commands:
127+
- func: test_code_snippets
128+
- func: archive_snippets_output
129+
130+
- name: test_kind_search_external_sharded_snippets.sh
131+
tags: [ "code_snippets", "patch-run" ]
132+
commands:
133+
- func: test_code_snippets
134+
- func: archive_snippets_output
135+
124136
task_groups:
125137
- name: gke_code_snippets_task_group
126138
<<: *setup_and_teardown_group_gke_code_snippets
@@ -136,6 +148,8 @@ task_groups:
136148
- test_kind_search_community_snippets.sh
137149
- test_kind_search_enterprise_snippets.sh
138150
- test_kind_search_external_mongod_snippets.sh
151+
- test_kind_search_sharded_enterprise_external_lb_snippets.sh
152+
- test_kind_search_external_sharded_snippets.sh
139153

140154
buildvariants:
141155
# These variants are used to test the code snippets and each one can be used in patches

docs/search/02-search-enterprise-deploy/env_variables_e2e_private_dev.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export K8S_CTX="kind-kind"
22

33
# patch id from evergreen patch
4-
version_id="688de361d940720007dc0267"
4+
version_id="6969124ffd1e5d00076895fa"
55

6-
search_image_repo="268558157000.dkr.ecr.eu-west-1.amazonaws.com/mongot"
7-
search_image_hash="fbd60fb055dd500058edcb45677ea85d19421f47"
6+
#search_image_repo="268558157000.dkr.ecr.eu-west-1.amazonaws.com/mongot"
7+
#search_image_hash="fbd60fb055dd500058edcb45677ea85d19421f47"
88

99
ecr="268558157000.dkr.ecr.us-east-1.amazonaws.com"
1010
declare -a helm_values=(
@@ -20,9 +20,9 @@ declare -a helm_values=(
2020
"initOpsManager.version=${version_id}"
2121
"initDatabase.version=${version_id}"
2222
"database.version=${version_id}"
23-
"search.community.repo=${search_image_repo}"
24-
"search.community.name=community"
25-
"search.community.version=${search_image_hash}"
23+
#"search.community.repo=${search_image_repo}"
24+
#"search.community.name=community"
25+
#"search.community.version=${search_image_hash}"
2626
)
2727

2828
SCRIPT_PATH="${BASH_SOURCE[0]}"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Validate required environment variables
2+
required_vars=(
3+
"K8S_CTX"
4+
"MDB_NS"
5+
"MDB_RESOURCE_NAME"
6+
"MDB_SHARD_COUNT"
7+
"MDB_MONGODS_PER_SHARD"
8+
"MDB_MONGOS_COUNT"
9+
"MDB_CONFIG_SERVER_COUNT"
10+
"MDB_VERSION"
11+
"OPS_MANAGER_API_URL"
12+
"OPS_MANAGER_API_USER"
13+
"OPS_MANAGER_API_KEY"
14+
"OPS_MANAGER_ORG_ID"
15+
"OPS_MANAGER_PROJECT_NAME"
16+
)
17+
18+
for var in "${required_vars[@]}"; do
19+
if [[ -z "${!var:-}" ]]; then
20+
echo "Error: Required environment variable ${var} is not set"
21+
exit 1
22+
fi
23+
done
24+
25+
# Default MDB_MONGOT_REPLICAS to 1 if not set
26+
export MDB_MONGOT_REPLICAS="${MDB_MONGOT_REPLICAS:-1}"
27+
28+
echo "All required environment variables are set"
29+
echo "Sharded cluster configuration:"
30+
echo " Shards: ${MDB_SHARD_COUNT}"
31+
echo " Mongods per shard: ${MDB_MONGODS_PER_SHARD}"
32+
echo " Mongot replicas per shard: ${MDB_MONGOT_REPLICAS}"
33+
34+
if [[ "${MDB_MONGOT_REPLICAS}" -gt 1 ]]; then
35+
echo " Note: Multiple mongot replicas configured - external LB endpoints will be used"
36+
fi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
kubectl create namespace "${MDB_NS}" --context "${K8S_CTX}" --dry-run=client -o yaml | kubectl apply --context "${K8S_CTX}" -f -
2+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" \
2+
create secret generic "image-registries-secret" \
3+
--from-file=.dockerconfigjson="${HOME}/.docker/config.json" --type=kubernetes.io/dockerconfigjson \
4+
--dry-run=client -o yaml | kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f -
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
helm repo add mongodb https://mongodb.github.io/helm-charts
2+
helm repo update mongodb
3+
helm search repo mongodb/mongodb-kubernetes
4+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
helm upgrade --install mongodb-kubernetes "${OPERATOR_HELM_CHART}" \
2+
--kube-context "${K8S_CTX}" \
3+
--namespace "${MDB_NS}" \
4+
--set operator.watchNamespace="${MDB_NS}" \
5+
${OPERATOR_ADDITIONAL_HELM_VALUES:+--set ${OPERATOR_ADDITIONAL_HELM_VALUES}}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Create ConfigMap for Ops Manager/Cloud Manager project configuration
2+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: om-project
7+
data:
8+
projectName: ${OPS_MANAGER_PROJECT_NAME}
9+
baseUrl: ${OPS_MANAGER_API_URL}
10+
orgId: ${OPS_MANAGER_ORG_ID}
11+
EOF
12+
13+
# Create Secret for Ops Manager/Cloud Manager credentials
14+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
15+
apiVersion: v1
16+
kind: Secret
17+
metadata:
18+
name: om-credentials
19+
type: Opaque
20+
stringData:
21+
user: ${OPS_MANAGER_API_USER}
22+
publicApiKey: ${OPS_MANAGER_API_KEY}
23+
EOF
24+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
helm upgrade --install \
2+
cert-manager \
3+
oci://quay.io/jetstack/charts/cert-manager \
4+
--kube-context "${K8S_CTX}" \
5+
--namespace "${CERT_MANAGER_NAMESPACE}" \
6+
--create-namespace \
7+
--set crds.enabled=true
8+
9+
for deployment in cert-manager cert-manager-cainjector cert-manager-webhook; do
10+
kubectl --context "${K8S_CTX}" \
11+
-n "${CERT_MANAGER_NAMESPACE}" \
12+
wait --for=condition=Available "deployment/${deployment}" --timeout=300s
13+
done
14+
15+
echo "cert-manager is ready in namespace ${CERT_MANAGER_NAMESPACE}."
16+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Bootstrap a self-signed ClusterIssuer to mint the CA secret consumed by application workloads.
2+
kubectl apply --context "${K8S_CTX}" -f - <<EOF_MANIFEST
3+
apiVersion: cert-manager.io/v1
4+
kind: ClusterIssuer
5+
metadata:
6+
name: ${MDB_TLS_SELF_SIGNED_ISSUER}
7+
spec:
8+
selfSigned: {}
9+
EOF_MANIFEST
10+
11+
kubectl --context "${K8S_CTX}" wait --for=condition=Ready clusterissuer "${MDB_TLS_SELF_SIGNED_ISSUER}"
12+
13+
kubectl apply --context "${K8S_CTX}" -f - <<EOF_MANIFEST
14+
apiVersion: cert-manager.io/v1
15+
kind: Certificate
16+
metadata:
17+
name: ${MDB_TLS_CA_CERT_NAME}
18+
namespace: ${CERT_MANAGER_NAMESPACE}
19+
spec:
20+
isCA: true
21+
commonName: ${MDB_TLS_CA_CERT_NAME}
22+
secretName: ${MDB_TLS_CA_SECRET_NAME}
23+
privateKey:
24+
algorithm: ECDSA
25+
size: 256
26+
issuerRef:
27+
name: ${MDB_TLS_SELF_SIGNED_ISSUER}
28+
kind: ClusterIssuer
29+
EOF_MANIFEST
30+
31+
kubectl --context "${K8S_CTX}" wait --for=condition=Ready -n "${CERT_MANAGER_NAMESPACE}" certificate "${MDB_TLS_CA_CERT_NAME}"
32+
33+
kubectl apply --context "${K8S_CTX}" -f - <<EOF_MANIFEST
34+
apiVersion: cert-manager.io/v1
35+
kind: ClusterIssuer
36+
metadata:
37+
name: ${MDB_TLS_CA_ISSUER}
38+
spec:
39+
ca:
40+
secretName: ${MDB_TLS_CA_SECRET_NAME}
41+
EOF_MANIFEST
42+
43+
kubectl --context "${K8S_CTX}" wait --for=condition=Ready clusterissuer "${MDB_TLS_CA_ISSUER}"
44+
45+
TMP_CA_CERT="$(mktemp)"
46+
trap 'rm -f "${TMP_CA_CERT}"' EXIT
47+
48+
kubectl --context "${K8S_CTX}" get secret "${MDB_TLS_CA_SECRET_NAME}" -n "${CERT_MANAGER_NAMESPACE}" -o jsonpath="{.data['ca\\.crt']}" | base64 --decode > "${TMP_CA_CERT}"
49+
50+
kubectl --context "${K8S_CTX}" create configmap "${MDB_TLS_CA_CONFIGMAP}" -n "${MDB_NS}" \
51+
--from-file=ca-pem="${TMP_CA_CERT}" --from-file=mms-ca.crt="${TMP_CA_CERT}" \
52+
--from-file=ca.crt="${TMP_CA_CERT}" \
53+
--dry-run=client -o yaml | kubectl --context "${K8S_CTX}" apply -f -
54+

0 commit comments

Comments
 (0)