-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee88e36
commit 3b4214e
Showing
8 changed files
with
56 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
#! /bin/bash | ||
#!/usr/bine/env bash | ||
|
||
kubectl delete fdb -l cluster-group=test-cluster | ||
set -eu | ||
|
||
# To test a multi-region FDB cluster setup we need to have 3 Kubernetes clusters | ||
cluster1=${CLUSTER1:-cluster1} | ||
cluster2=${CLUSTER2:-cluster2} | ||
cluster3=${CLUSTER3:-cluster3} | ||
|
||
# For all the clusters we have to create tha according kubeconfig | ||
kubeconfig1=${KUBECONFIG1:-"${cluster1}.kubeconfig"} | ||
kubeconfig2=${KUBECONFIG2:-"${cluster2}.kubeconfig"} | ||
kubeconfig3=${KUBECONFIG3:-"${cluster3}.kubeconfig"} | ||
|
||
kubectl --kubeconfig "${kubeconfig1}" delete fdb -l cluster-group=test-cluster | ||
kubectl --kubeconfig "${kubeconfig2}" delete fdb -l cluster-group=test-cluster | ||
kubectl --kubeconfig "${kubeconfig3}" delete fdb -l cluster-group=test-cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,28 @@ | ||
function applyFile() { | ||
path=$1 | ||
zone=$2 | ||
connectionString=$3 | ||
zoneIndex=${zone:2:1} | ||
|
||
sed -e "s/\$zoneIndex/$zoneIndex/" $path | sed -e "s/\$zone/$zone/" | sed -e "s/\$connectionString/$connectionString/" | kubectl apply -f - | ||
zone="${zone}" zoneIndex="${zone:2:1}" connectionString="${3}" envsubst < "${1}" | kubectl --kubeconfig "${4}" apply -f - | ||
} | ||
|
||
function checkReconciliation() { | ||
clusterName=$1 | ||
|
||
generationsOutput=$(kubectl get fdb $clusterName -o jsonpath='{.metadata.generation} {.status.generations.reconciled}') | ||
read -ra generations <<< $generationsOutput | ||
if [[ ("${generations[1]}" != "") && ("${generations[0]}" == "${generations[1]}") ]]; then | ||
generationsOutput=$(kubectl --kubeconfig "${2}" get fdb "${clusterName}" -o jsonpath='{.metadata.generation} {.status.generations.reconciled}') | ||
read -ra generations <<< "${generationsOutput}" | ||
if [[ ("${#generations[@]}" -ge 2) && ("${generations[0]}" == "${generations[1]}") ]]; then | ||
return 1 | ||
else | ||
echo "Latest generations for $clusterName: $generationsOutput" | ||
return 0 | ||
fi | ||
} | ||
|
||
|
||
function getConnectionString() { | ||
clusterName=$1 | ||
|
||
kubectl get fdb $clusterName -o jsonpath='{.status.connectionString}' | ||
kubectl --kubeconfig "${2}" get fdb "${1}" -o jsonpath='{.status.connectionString}' | ||
} | ||
|
||
|
||
function checkReconciliationLoop() { | ||
reconciled=0 | ||
name=$1 | ||
while [ $reconciled -ne 1 ] ; do | ||
checkReconciliation $name | ||
reconciled=$? | ||
if [[ $reconciled -ne 1 ]]; then | ||
echo "Waiting for reconcilliation" | ||
sleep 5 | ||
fi | ||
while checkReconciliation "${1}" "${2}"; do | ||
echo "Waiting for reconciliation" | ||
sleep 5 | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters