Skip to content

Commit 3420ed1

Browse files
committed
wip
1 parent fb2e7a8 commit 3420ed1

9 files changed

+240
-156
lines changed

scripts/code_snippets/tests/test_gke_multi_cluster_snippets.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ function cleanup() {
2626
fi
2727
}
2828

29+
dump_logs() {
30+
scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh "${K8S_CLUSTER_0_CONTEXT_NAME}"
31+
scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh "${K8S_CLUSTER_1_CONTEXT_NAME}"
32+
scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh "${K8S_CLUSTER_2_CONTEXT_NAME}"
33+
}
34+
35+
cmd=${1}
36+
if [[ "${cmd}" == "dump_logs" ]]; then
37+
source public/architectures/setup-multi-cluster/ra-01-setup-gke/env_variables.sh
38+
dump_logs
39+
exit 0
40+
elif [[ "${cmd}" == "cleanup" ]]; then
41+
source public/architectures/setup-multi-cluster/ra-01-setup-gke/env_variables.sh
42+
cleanup
43+
exit 0
44+
fi
45+
# if no cmd, proceed with the test normally
46+
2947
function on_exit() {
30-
scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh
48+
dump_logs
3149
cleanup
3250
}
3351

scripts/code_snippets/tests/test_kind_search_community_snippets.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ mkdir -p "${_SNIPPETS_OUTPUT_DIR}"
1414
dump_logs() {
1515
source scripts/evergreen/e2e/dump_diagnostic_information.sh
1616
if [[ "${SKIP_DUMP:-"false"}" != "true" ]]; then
17-
dump_all_non_default_namespaces "$@"
17+
# If no context provided, use current context
18+
if [ $# -eq 0 ]; then
19+
dump_all_non_default_namespaces "$(kubectl config current-context)"
20+
else
21+
dump_all_non_default_namespaces "$@"
22+
fi
1823
echo
1924
fi
2025
}

scripts/dev/contexts/prerelease_gke_code_snippets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ script_dir=$(dirname "${script_name}")
1010
source "${script_dir}/root-context"
1111

1212
export MDB_GKE_PROJECT="scratch-kubernetes-team"
13-
export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}"
13+
export K8S_CLUSTER_SUFFIX="${K8S_CLUSTER_SUFFIX:-"-${version_id}-${RANDOM}"}"
1414
export CODE_SNIPPETS_COMMIT_OUTPUT=true
1515

1616
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host
@@ -19,3 +19,4 @@ export EVG_HOST_NAME=""
1919
# ENV_VARIABLES.SH overrides
2020
export OPERATOR_ADDITIONAL_HELM_VALUES=""
2121
export OPERATOR_HELM_CHART=${PROJECT_DIR}/helm_chart
22+

scripts/dev/contexts/private_gke_code_snippets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ script_dir=$(dirname "${script_name}")
1010
source "${script_dir}/root-context"
1111
source "${script_dir}/variables/om80"
1212

13+
export KUBE_ENVIRONMENT_NAME=multi
14+
1315
export MDB_GKE_PROJECT="scratch-kubernetes-team"
14-
export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}"
16+
export K8S_CLUSTER_SUFFIX="${K8S_CLUSTER_SUFFIX:-"-${version_id}-${RANDOM}"}"
1517

1618
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host
1719
export EVG_HOST_NAME=""
@@ -21,3 +23,5 @@ source scripts/funcs/operator_deployment
2123
OPERATOR_ADDITIONAL_HELM_VALUES="$(get_operator_helm_values | tr ' ' ','),customEnvVars=OM_DEBUG_HTTP=true"
2224
export OPERATOR_ADDITIONAL_HELM_VALUES
2325
export OPERATOR_HELM_CHART="${PROJECT_DIR}/helm_chart"
26+
27+
export CLUSTER_NAME="${K8S_CONTEXT_0_CONTEXT_NAME}"

scripts/dev/contexts/public_gke_code_snippets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ script_dir=$(dirname "${script_name}")
99

1010
source "${script_dir}/root-context"
1111

12+
export KUBE_ENVIRONMENT_NAME=multi
13+
1214
export MDB_GKE_PROJECT="scratch-kubernetes-team"
1315
# shellcheck disable=SC2154
14-
export K8S_CLUSTER_SUFFIX="-${version_id}-${RANDOM}"
16+
export K8S_CLUSTER_SUFFIX="${K8S_CLUSTER_SUFFIX:-"-${version_id}-${RANDOM}"}"
1517

1618
# we reset evg host to use a default ~/.kube/config for GKE instead of the one from evg host
1719
export EVG_HOST_NAME=""

scripts/evergreen/e2e/dump_diagnostic_information.sh

Lines changed: 193 additions & 146 deletions
Large diffs are not rendered by default.

scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ set +e
77
source scripts/funcs/printing
88
source scripts/evergreen/e2e/dump_diagnostic_information.sh
99

10-
dump_all_non_default_namespaces "$@"
10+
# If no context provided, use current context
11+
if [ $# -eq 0 ]; then
12+
dump_all_non_default_namespaces "$(kubectl config current-context)"
13+
else
14+
dump_all_non_default_namespaces "$@"
15+
fi

scripts/evergreen/e2e/e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dump_cluster_information() {
4242
done
4343
else
4444
# Dump all the information we can from this namespace
45-
dump_all || true
45+
dump_all "$(kubectl config current-context)" || true
4646
fi
4747
}
4848

scripts/funcs/operator_deployment

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ get_operator_helm_values() {
6969

7070
# shellcheck disable=SC2154
7171
if [[ "${KUBE_ENVIRONMENT_NAME-}" = "multi" ]]; then
72-
comma_separated_list="$(echo "${MEMBER_CLUSTERS}" | tr ' ' ',')"
73-
# shellcheck disable=SC2154
74-
config+=("multiCluster.clusters={${comma_separated_list}}")
72+
if [[ -n "${MEMBER_CLUSTERS:-}" ]]; then
73+
comma_separated_list="$(echo "${MEMBER_CLUSTERS}" | tr ' ' ',')"
74+
# shellcheck disable=SC2154
75+
config+=("multiCluster.clusters={${comma_separated_list}}")
76+
fi
7577
config+=("operator.createOperatorServiceAccount=false")
7678
fi
7779

0 commit comments

Comments
 (0)