-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for three data hall replication
- Loading branch information
1 parent
7ec1d8e
commit fe562f1
Showing
17 changed files
with
543 additions
and
33 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 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 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Three-Data-hall example | ||
|
||
This example requires that your Kubernetes cluster has nodes which are labeled with `topology.kubernetes.io/zone`. | ||
The example requires at least 3 unique zones, those can be faked for testing, by adding the labels to a node. | ||
If you want to use cloud provider specific zone label values you can set the `AZ1`, `AZ2` and `AZ3` environment variables. | ||
|
||
## Create the Three-Data-Hall cluster | ||
|
||
This will bring up a FDB cluster using the three-data-hall redundancy mode. | ||
|
||
```bash | ||
./create.bash | ||
``` | ||
|
||
## Delete | ||
|
||
This will remove all created resources: | ||
|
||
```bash | ||
./delete.bash | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
# This directory provides an example of creating a cluster using the three_data_hall | ||
# replication topology. | ||
# | ||
# This example is built for local testing, so it will create all of the Pods | ||
# within a single Kubernetes cluster, but will give false locality information for the zones | ||
# to make the processes believe they are in different locations. | ||
# | ||
# You can use this script to bootstrap the cluster. Once it finishes, you can | ||
# make changes to the cluster by editing the final.yaml file and running the | ||
# apply.bash script. You can clean up the clusters by running the delete.bash | ||
# script. | ||
DIR="${BASH_SOURCE%/*}" | ||
|
||
. $DIR/functions.bash | ||
|
||
AZ1=${AZ1:-"az1"} | ||
AZ2=${AZ2:-"az2"} | ||
AZ3=${AZ3:-"az3"} | ||
|
||
applyFile "${DIR}/stage_1.yaml" "${AZ1}" '""' | ||
checkReconciliationLoop test-cluster-${AZ1} | ||
connectionString=$(getConnectionString test-cluster-${AZ1}) | ||
|
||
applyFile "${DIR}/final.yaml" "${AZ1}" "${connectionString}" | ||
applyFile "${DIR}/final.yaml" ${AZ2} "${connectionString}" | ||
applyFile "${DIR}/final.yaml" ${AZ3} "${connectionString}" | ||
|
||
checkReconciliationLoop test-cluster-${AZ1} | ||
checkReconciliationLoop test-cluster-${AZ2} | ||
checkReconciliationLoop test-cluster-${AZ3} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
kubectl 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This file provides an example of a cluster you can run in a local testing | ||
# environment to create a simulation of a three_data_hall cluster. | ||
# | ||
# This requires variables to be interpolated for $az and $connectionString | ||
apiVersion: apps.foundationdb.org/v1beta2 | ||
kind: FoundationDBCluster | ||
metadata: | ||
labels: | ||
cluster-group: test-cluster | ||
name: test-cluster-$az | ||
spec: | ||
version: 7.1.26 | ||
faultDomain: | ||
key: foundationdb.org/none | ||
processGroupIDPrefix: $az | ||
dataHall: $az | ||
processCounts: | ||
stateless: -1 | ||
seedConnectionString: $connectionString | ||
databaseConfiguration: | ||
redundancy_mode: "three_data_hall" | ||
processes: | ||
general: | ||
customParameters: | ||
- "knob_disable_posix_kernel_aio=1" | ||
volumeClaimTemplate: | ||
spec: | ||
resources: | ||
requests: | ||
storage: "16G" | ||
podTemplate: | ||
spec: | ||
nodeSelector: | ||
"topology.kubernetes.io/zone": "$az" | ||
containers: | ||
- name: foundationdb | ||
resources: | ||
requests: | ||
cpu: 250m | ||
memory: 128Mi |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function applyFile() { | ||
az=${2} | ||
|
||
az="${az}" connectionString="${3}" envsubst < "${1}"| kubectl apply -f - | ||
} | ||
|
||
function checkReconciliation() { | ||
clusterName=$1 | ||
|
||
generationsOutput=$(kubectl 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() { | ||
kubectl get fdb "${1}" -o jsonpath='{.status.connectionString}' | ||
} | ||
|
||
function checkReconciliationLoop() { | ||
while checkReconciliation "${1}" ; 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This file provides an example of a cluster you can run in a local testing | ||
# environment to create a simulation of a three_data_hall cluster. | ||
# | ||
# This requires variables to be interpolated for $az and $connectionString | ||
apiVersion: apps.foundationdb.org/v1beta2 | ||
kind: FoundationDBCluster | ||
metadata: | ||
labels: | ||
cluster-group: test-cluster | ||
name: test-cluster-$az | ||
spec: | ||
version: 7.1.26 | ||
faultDomain: | ||
key: foundationdb.org/none | ||
processGroupIDPrefix: $az | ||
dataHall: $az | ||
processCounts: | ||
stateless: -1 | ||
seedConnectionString: $connectionString | ||
databaseConfiguration: | ||
redundancy_mode: "triple" | ||
processes: | ||
general: | ||
customParameters: | ||
- "knob_disable_posix_kernel_aio=1" | ||
volumeClaimTemplate: | ||
spec: | ||
resources: | ||
requests: | ||
storage: "16G" | ||
podTemplate: | ||
spec: | ||
nodeSelector: | ||
"topology.kubernetes.io/zone": "$az" | ||
containers: | ||
- name: foundationdb | ||
resources: | ||
requests: | ||
cpu: 250m | ||
memory: 128Mi |
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
Oops, something went wrong.