ceph-csi/scripts/rook.sh
Woohyung Han 2c9d711463 Move rook-deploy code from e2e to ./scripts/minikube.sh
We have the e2e test with --deploy-rook=true that makes all test
environment. It works fine, but It does not seem to be the role of
e2e test. In addition, when developing the code we need to run full
test scenario with deploying rook every time, or we need to build
rook environment by hand. Move rook-deploy code to minikube.sh.
2019-12-05 12:32:59 +00:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -e
ROOK_VERSION=${ROOK_VERSION:-"v1.1.7"}
ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300}
ROOK_URL="https://raw.githubusercontent.com/rook/rook/${ROOK_VERSION}/cluster/examples/kubernetes/ceph"
function deploy_rook() {
kubectl create -f "${ROOK_URL}/common.yaml"
kubectl create -f "${ROOK_URL}/operator.yaml"
kubectl create -f "${ROOK_URL}/cluster-test.yaml"
kubectl create -f "${ROOK_URL}/toolbox.yaml"
kubectl create -f "${ROOK_URL}/filesystem-test.yaml"
kubectl create -f "${ROOK_URL}/pool-test.yaml"
for ((retry=0; retry<=ROOK_DEPLOY_TIMEOUT; retry=retry+5)); do
echo "Wait for rook deploy... ${retry}s"
sleep 5
if kubectl get cephclusters -n rook-ceph | grep HEALTH_OK &> /dev/null; then
break
fi
done
}
function teardown_rook() {
kubectl delete -f "${ROOK_URL}/pool-test.yaml"
kubectl delete -f "${ROOK_URL}/filesystem-test.yaml"
kubectl delete -f "${ROOK_URL}/toolbox.yaml"
kubectl delete -f "${ROOK_URL}/cluster-test.yaml"
kubectl delete -f "${ROOK_URL}/operator.yaml"
kubectl delete -f "${ROOK_URL}/common.yaml"
}
case "${1:-}" in
deploy)
deploy_rook
;;
teardown)
teardown_rook
;;
*)
echo " $0 [command]
Available Commands:
deploy Deploy a rook
teardown Teardown a rook
" >&2
;;
esac