Skip to content

Commit 10f35fe

Browse files
committed
Refactor of snippets (enterprise search)
1 parent 6309cff commit 10f35fe

File tree

45 files changed

+216
-899
lines changed

Some content is hidden

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

45 files changed

+216
-899
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kubectl --context "${K8S_CTX}" create namespace "${MDB_NS}"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" \
1+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" \
22
create secret generic "image-registries-secret" \
33
--from-file=.dockerconfigjson="${HOME}/.docker/config.json" --type=kubernetes.io/dockerconfigjson
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}" create configmap om-project \
2+
--from-literal=projectName="${MDB_RESOURCE_NAME}" --from-literal=baseUrl="${OPS_MANAGER_API_URL}" \
3+
--from-literal=orgId="${OPS_MANAGER_ORG_ID:-}"
4+
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
helm upgrade --install --debug --kube-context "${K8S_CLUSTER_0_CONTEXT_NAME}" \
1+
helm upgrade --install --debug --kube-context "${K8S_CTX}" \
22
--create-namespace \
3-
--namespace="${MDB_NAMESPACE}" \
3+
--namespace="${MDB_NS}" \
44
mongodb-kubernetes \
55
--set "${OPERATOR_ADDITIONAL_HELM_VALUES:-"dummy=value"}" \
66
"${OPERATOR_HELM_CHART}"

docs/search/enterprise/quick-start/code_snippets/0305_create_mongodb_database_resource.sh renamed to docs/search/02-search-enterprise-deploy/code_snippets/02_0305_create_mongodb_database_resource.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
kubectl apply --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -f - <<EOF
1+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
22
---
33
apiVersion: mongodb.com/v1
44
kind: MongoDB
55
metadata:
6-
name: mdb-rs
6+
name: ${MDB_RESOURCE_NAME}
77
spec:
88
members: 3
99
version: ${MDB_VERSION}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
echo "Waiting for MongoDB resource to reach Running phase..."
2+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" wait --for=jsonpath='{.status.phase}'=Running "mdb/${MDB_RESOURCE_NAME}" --timeout=400s
3+
echo; echo "MongoDB resource"
4+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" get "mdb/${MDB_RESOURCE_NAME}"
5+
echo; echo "Pods running in cluster ${K8S_CTX}"
6+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" get pods

docs/search/enterprise/quick-start/code_snippets/0315_create_mongodb_users.sh renamed to docs/search/02-search-enterprise-deploy/code_snippets/02_0315_create_mongodb_users.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# admin user with root role
2-
kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" --namespace "${MDB_NAMESPACE}" \
2+
kubectl --context "${K8S_CTX}" --namespace "${MDB_NS}" \
33
create secret generic mdb-admin-user-password \
44
--from-literal=password="${MDB_ADMIN_USER_PASSWORD}"
5-
kubectl apply --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -f - <<EOF
5+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
66
apiVersion: mongodb.com/v1
77
kind: MongoDBUser
88
metadata:
@@ -11,7 +11,7 @@ spec:
1111
username: mdb-admin
1212
db: admin
1313
mongodbResourceRef:
14-
name: mdb-rs
14+
name: ${MDB_RESOURCE_NAME}
1515
passwordSecretKeyRef:
1616
name: mdb-admin-user-password
1717
key: password
@@ -23,10 +23,10 @@ EOF
2323
# user used by MongoDB Search to connect to MongoDB database to synchronize data from
2424
# For MongoDB <8.2, the operator will be creating the searchCoordinator custom role automatically
2525
# From MongoDB 8.2, searchCoordinator role will be a built-in role.
26-
kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" --namespace "${MDB_NAMESPACE}" \
26+
kubectl --context "${K8S_CTX}" --namespace "${MDB_NS}" \
2727
create secret generic mdb-rs-search-sync-source-password \
2828
--from-literal=password="${MDB_SEARCH_SYNC_USER_PASSWORD}"
29-
kubectl apply --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -f - <<EOF
29+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
3030
apiVersion: mongodb.com/v1
3131
kind: MongoDBUser
3232
metadata:
@@ -35,7 +35,7 @@ spec:
3535
username: search-sync-source
3636
db: admin
3737
mongodbResourceRef:
38-
name: mdb-rs
38+
name: ${MDB_RESOURCE_NAME}
3939
passwordSecretKeyRef:
4040
name: mdb-rs-search-sync-source-password
4141
key: password
@@ -45,10 +45,10 @@ spec:
4545
EOF
4646

4747
# user performing search queries
48-
kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" --namespace "${MDB_NAMESPACE}" \
48+
kubectl --context "${K8S_CTX}" --namespace "${MDB_NS}" \
4949
create secret generic mdb-user-password \
5050
--from-literal=password="${MDB_USER_PASSWORD}"
51-
kubectl apply --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -f - <<EOF
51+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
5252
apiVersion: mongodb.com/v1
5353
kind: MongoDBUser
5454
metadata:
@@ -57,7 +57,7 @@ spec:
5757
username: mdb-user
5858
db: admin
5959
mongodbResourceRef:
60-
name: mdb-rs
60+
name: ${MDB_RESOURCE_NAME}
6161
passwordSecretKeyRef:
6262
name: mdb-user-password
6363
key: password

docs/search/enterprise/quick-start/code_snippets/0320_create_mongodb_search_resource.sh renamed to docs/search/02-search-enterprise-deploy/code_snippets/02_0320_create_mongodb_search_resource.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
kubectl apply --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" -f - <<EOF
1+
kubectl apply --context "${K8S_CTX}" -n "${MDB_NS}" -f - <<EOF
22
apiVersion: mongodb.com/v1
33
kind: MongoDBSearch
44
metadata:
5-
name: mdb-rs
5+
name: ${MDB_RESOURCE_NAME}
66
spec:
77
resourceRequirements:
88
limits:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo "Waiting for MongoDBSearch resource to reach Running phase..."
2+
kubectl --context "${K8S_CTX}" -n "${MDB_NS}" wait --for=jsonpath='{.status.phase}'=Running mdbs/mdb-rs --timeout=300s

0 commit comments

Comments
 (0)