Skip to content

Commit 71420c2

Browse files
authored
Allow to set the namespace in the three data hall example (#1892)
1 parent a532d76 commit 71420c2

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

config/tests/three_data_hall/Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This example requires that your Kubernetes cluster has nodes which are labeled with `topology.kubernetes.io/zone`.
44
The example requires at least 3 unique zones, those can be faked for testing, by adding the labels to a node.
55
If you want to use cloud provider specific zone label values you can set the `AZ1`, `AZ2` and `AZ3` environment variables.
6+
You can also set the namespace with the `NAMESPACE` environment variable to deploy this setup in a specific namespace.
67

78
## Create the Three-Data-Hall cluster
89

config/tests/three_data_hall/create.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DIR="${BASH_SOURCE%/*}"
2020
AZ1=${AZ1:-"az1"}
2121
AZ2=${AZ2:-"az2"}
2222
AZ3=${AZ3:-"az3"}
23+
NAMESPACE=${NAMESPACE=-"default"}
2324

2425
applyFile "${DIR}/stage_1.yaml" "${AZ1}" '""'
2526
checkReconciliationLoop test-cluster-${AZ1}

config/tests/three_data_hall/delete.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -eu
44

5-
kubectl delete fdb -l cluster-group=test-cluster
5+
kubectl -n "${NAMESPACE}" delete fdb -l cluster-group=test-cluster

config/tests/three_data_hall/functions.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
function applyFile() {
22
az=${2}
33

4-
az="${az}" connectionString="${3}" envsubst < "${1}"| kubectl apply -f -
4+
az="${az}" connectionString="${3}" envsubst < "${1}"| kubectl -n "${NAMESPACE}" apply -f -
55
}
66

77
function checkReconciliation() {
88
clusterName=$1
99

10-
generationsOutput=$(kubectl get fdb "${clusterName}" -o jsonpath='{.metadata.generation} {.status.generations.reconciled}')
10+
generationsOutput=$(kubectl -n "${NAMESPACE}" get fdb "${clusterName}" -o jsonpath='{.metadata.generation} {.status.generations.reconciled}')
1111
read -ra generations <<< "${generationsOutput}"
1212
if [[ ("${#generations[@]}" -ge 2) && ("${generations[0]}" == "${generations[1]}") ]]; then
1313
return 1
@@ -18,7 +18,7 @@ function checkReconciliation() {
1818
}
1919

2020
function getConnectionString() {
21-
kubectl get fdb "${1}" -o jsonpath='{.status.connectionString}'
21+
kubectl -n "${NAMESPACE}" get fdb "${1}" -o jsonpath='{.status.connectionString}'
2222
}
2323

2424
function checkReconciliationLoop() {

0 commit comments

Comments
 (0)