-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from arangodb/prepare-cluster-for-test
Prepare test cluster
- Loading branch information
Showing
6 changed files
with
99 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Test clusters | ||
|
||
The ArangoDB operator is tested on various types of kubernetes clusters. | ||
|
||
To prepare a cluster for running the ArangoDB operator tests, | ||
do the following: | ||
|
||
- Create a `kubectl` config file for accessing the cluster. | ||
- Use that config file. | ||
- Run `./scripts/kube_configure_test_cluster.sh`. This creates a `ConfigMap` | ||
named `arango-operator-test` in the `kube-system` namespace containing the | ||
following environment variables. | ||
|
||
```bash | ||
REQUIRE_LOCAL_STORAGE=1 | ||
``` |
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,28 @@ | ||
#!/bin/bash | ||
|
||
# Sets the configuration of the cluster in a ConfigMap in kube-system. | ||
|
||
cluster=$(kubectl config current-context) | ||
echo "Configuring cluster $cluster" | ||
|
||
read -p "Does the cluster require local storage (Y/n)? " answer | ||
case ${answer:0:1} in | ||
n|N ) | ||
REQUIRE_LOCAL_STORAGE= | ||
;; | ||
* ) | ||
REQUIRE_LOCAL_STORAGE=1 | ||
;; | ||
esac | ||
|
||
mapname="arango-operator-test" | ||
configfile=$(mktemp) | ||
cat <<EOF > $configfile | ||
REQUIRE_LOCAL_STORAGE=${REQUIRE_LOCAL_STORAGE} | ||
EOF | ||
kubectl delete configmap $mapname -n kube-system --ignore-not-found | ||
kubectl create configmap $mapname -n kube-system --from-env-file=$configfile || exit 1 | ||
|
||
echo Stored configuration: | ||
cat $configfile | ||
rm $configfile |
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,22 @@ | ||
#!/bin/bash | ||
|
||
# Create the local storage in the cluster if the cluster needs it. | ||
|
||
NS=$1 | ||
|
||
if [ -z $NS ]; then | ||
echo "Specify a namespace argument" | ||
exit 1 | ||
fi | ||
|
||
# Fetch cluster config | ||
mapname="arango-operator-test" | ||
eval $(kubectl get configmap $mapname -n kube-system --ignore-not-found --template='{{ range $key, $value := .data }}export {{$key}}={{$value}} | ||
{{ end }}') | ||
|
||
if [ "${REQUIRE_LOCAL_STORAGE}" = "1" ]; then | ||
echo "Preparing local storage" | ||
kubectl apply -n $NS -f examples/arango-local-storage.yaml || exit 1 | ||
else | ||
echo "No local storage needed for this cluster" | ||
fi |
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