1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

Merged master

This commit is contained in:
Ewout Prangsma 2018-03-12 09:54:57 +01:00
commit 5ab9a62cf6
No known key found for this signature in database
GPG key ID: 4DBAD380D93D0698
7 changed files with 100 additions and 6 deletions

View file

@ -201,6 +201,7 @@ endif
kubectl create namespace $(TESTNAMESPACE)
$(ROOTDIR)/examples/setup-rbac.sh --namespace=$(TESTNAMESPACE)
$(ROOTDIR)/scripts/kube_create_operator.sh $(TESTNAMESPACE) $(OPERATORIMAGE)
$(ROOTDIR)/scripts/kube_create_storage.sh $(TESTNAMESPACE)
kubectl --namespace $(TESTNAMESPACE) \
run arangodb-operator-test -i --rm --quiet --restart=Never \
--image=$(TESTIMAGE) \

View file

@ -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
```

View file

@ -7,5 +7,6 @@
- [Scaling](./scaling.md)
- [Services & Load balancer](./services_and_loadbalancer.md)
- [Storage](./storage.md)
- [Storage Resource](./storage_resource.md)
- [TLS](./tls.md)
- [Upgrading](./upgrading.md)

View file

@ -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

View file

@ -19,7 +19,7 @@ if [ ! -z $USESHA256 ]; then
IMAGE=$(docker inspect --format='{{index .RepoDigests 0}}' ${IMAGE})
fi
kubectl --namespace=$NS create -f - << EOYAML
config=$(cat << EOYAML
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
@ -46,5 +46,27 @@ spec:
fieldPath: metadata.name
EOYAML
)
echo "$config" | kubectl --namespace=$NS create -f - || exit 1
exit $?
# Wait until custom resources are available
while :; do
response=$(kubectl get crd arangodeployments.database.arangodb.com --template="non-empty" --ignore-not-found)
if [ ! -z $response ]; then
break
fi
sleep 1
echo -n .
done
while :; do
response=$(kubectl get crd arangolocalstorages.storage.arangodb.com --template="non-empty" --ignore-not-found)
if [ ! -z $response ]; then
break
fi
sleep 1
echo -n .
done
echo "Arango Operator deployed"

22
scripts/kube_create_storage.sh Executable file
View file

@ -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

View file

@ -10,8 +10,12 @@ if [ -z $NS ]; then
fi
kubectl delete namespace $NS --now --ignore-not-found
response=$(kubectl get namespace $NS --template="non-empty" --ignore-not-found)
while [ ! -z $response ]; do
sleep 1
response=$(kubectl get namespace $NS --template="non-empty" --ignore-not-found)
# Wait until its really gone
while :; do
response=$(kubectl get namespace $NS --template="non-empty" --ignore-not-found)
if [ -z $response ]; then
break
fi
sleep 0.5
done