mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
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.
This commit is contained in:
committed by
mergify[bot]
parent
685e2540a8
commit
2c9d711463
@ -61,6 +61,11 @@ VM_DRIVER=${VM_DRIVER:-"virtualbox"}
|
||||
#configure image repo
|
||||
CEPHCSI_IMAGE_REPO=${CEPHCSI_IMAGE_REPO:-"quay.io/cephcsi"}
|
||||
K8S_IMAGE_REPO=${K8S_IMAGE_REPO:-"quay.io/k8scsi"}
|
||||
DISK="sda1"
|
||||
if [[ "${VM_DRIVER}" == "kvm2" ]]; then
|
||||
# use vda1 instead of sda1 when running with the libvirt driver
|
||||
DISK="vda1"
|
||||
fi
|
||||
|
||||
#feature-gates for kube
|
||||
K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-"BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true,ExpandCSIVolumes=true"}
|
||||
@ -77,11 +82,6 @@ up)
|
||||
echo "starting minikube with kubeadm bootstrapper"
|
||||
minikube start --memory="${MEMORY}" -b kubeadm --kubernetes-version="${KUBE_VERSION}" --vm-driver="${VM_DRIVER}" --feature-gates="${K8S_FEATURE_GATES}"
|
||||
|
||||
DISK="sda1"
|
||||
if [[ "${VM_DRIVER}" == "kvm2" ]]; then
|
||||
# use vda1 instead of sda1 when running with the libvirt driver
|
||||
DISK="vda1"
|
||||
fi
|
||||
# create a link so the default dataDirHostPath will work for this
|
||||
# environment
|
||||
if [[ "${VM_DRIVER}" != "none" ]]; then
|
||||
@ -99,6 +99,18 @@ ssh)
|
||||
echo "connecting to minikube"
|
||||
minikube ssh
|
||||
;;
|
||||
deploy-rook)
|
||||
echo "deploy rook"
|
||||
./scripts/rook.sh deploy
|
||||
;;
|
||||
teardown-rook)
|
||||
echo "teardown rook"
|
||||
./scripts/rook.sh teardown
|
||||
|
||||
# delete rook data for minikube
|
||||
minikube ssh "sudo rm -rf /mnt/${DISK}/var/lib/rook; sudo rm -rf /var/lib/rook"
|
||||
minikube ssh "sudo mkdir -p /mnt/${DISK}/var/lib/rook; sudo ln -s /mnt/${DISK}/var/lib/rook /var/lib/rook"
|
||||
;;
|
||||
cephcsi)
|
||||
echo "copying the cephcsi image"
|
||||
copy_image_to_cluster "${CEPHCSI_IMAGE_REPO}"/cephcsi:canary "${CEPHCSI_IMAGE_REPO}"/cephcsi:canary
|
||||
@ -120,6 +132,8 @@ Available Commands:
|
||||
down Stops a running local kubernetes cluster
|
||||
clean Deletes a local kubernetes cluster
|
||||
ssh Log into or run a command on a minikube machine with SSH
|
||||
deploy-rook Deploy rook to minikube
|
||||
teardown-rook Teardown a rook from minikube
|
||||
cephcsi copy built docker images to kubernetes cluster
|
||||
k8s-sidecar copy kubernetes sidecar docker images to kubernetes cluster
|
||||
" >&2
|
||||
|
48
scripts/rook.sh
Executable file
48
scripts/rook.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/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
|
@ -5,12 +5,13 @@ set -e
|
||||
# against different kuberentes version
|
||||
export KUBE_VERSION=$1
|
||||
sudo scripts/minikube.sh up
|
||||
sudo scripts/minikube.sh deploy-rook
|
||||
# pull docker images to speed up e2e
|
||||
sudo scripts/minikube.sh cephcsi
|
||||
sudo scripts/minikube.sh k8s-sidecar
|
||||
sudo chown -R travis: "$HOME"/.minikube /usr/local/bin/kubectl
|
||||
# functional tests
|
||||
|
||||
go test github.com/ceph/ceph-csi/e2e --rook-version=v1.1.0 --deploy-rook=true --deploy-timeout=10 -timeout=30m -v
|
||||
go test github.com/ceph/ceph-csi/e2e --deploy-timeout=10 -timeout=30m -v
|
||||
|
||||
sudo scripts/minikube.sh clean
|
||||
|
Reference in New Issue
Block a user