2019-05-22 05:50:53 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
#Based on ideas from https://github.com/rook/rook/blob/master/tests/scripts/minikube.sh
|
|
|
|
|
|
|
|
function wait_for_ssh() {
|
|
|
|
local tries=100
|
|
|
|
while ((tries > 0)); do
|
2020-07-28 08:32:33 +00:00
|
|
|
if ${minikube} ssh echo connected &>/dev/null; then
|
2019-05-22 05:50:53 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
tries=$((tries - 1))
|
|
|
|
sleep 0.1
|
|
|
|
done
|
|
|
|
echo ERROR: ssh did not come up >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function copy_image_to_cluster() {
|
|
|
|
local build_image=$1
|
|
|
|
local final_image=$2
|
2020-09-03 07:26:16 +00:00
|
|
|
validate_container_cmd
|
|
|
|
if [ -z "$(${CONTAINER_CMD} images -q "${build_image}")" ]; then
|
|
|
|
${CONTAINER_CMD} pull "${build_image}"
|
2019-05-29 10:02:16 +00:00
|
|
|
fi
|
2022-10-07 15:50:27 +00:00
|
|
|
if [[ "${VM_DRIVER}" == "none" ]] || [[ "${VM_DRIVER}" == "podman" ]]; then
|
2020-09-03 07:26:16 +00:00
|
|
|
${CONTAINER_CMD} tag "${build_image}" "${final_image}"
|
2019-05-22 05:50:53 +00:00
|
|
|
return
|
|
|
|
fi
|
2020-09-24 12:06:01 +00:00
|
|
|
|
|
|
|
# "minikube ssh" fails to read the image, so use standard ssh instead
|
|
|
|
${CONTAINER_CMD} save "${build_image}" | \
|
|
|
|
ssh \
|
|
|
|
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
|
|
|
|
-i "$(${minikube} ssh-key)" -l docker \
|
|
|
|
"$(${minikube} ip)" docker image load
|
2019-05-22 05:50:53 +00:00
|
|
|
}
|
|
|
|
|
2020-07-08 02:22:49 +00:00
|
|
|
# parse the minikube version, return the digit passed as argument
|
|
|
|
# v1.11.0 -> minikube_version 1 -> 1
|
|
|
|
# v1.11.0 -> minikube_version 2 -> 11
|
|
|
|
# v1.11.0 -> minikube_version 3 -> 0
|
|
|
|
minikube_version() {
|
|
|
|
echo "${MINIKUBE_VERSION}" | sed 's/^v//' | cut -d'.' -f"${1}"
|
|
|
|
}
|
|
|
|
|
2022-01-07 08:47:03 +00:00
|
|
|
# parse the kubernetes version, return the digit passed as argument
|
|
|
|
# v1.21.0 -> kube_version 1 -> 1
|
|
|
|
# v1.21.0 -> kube_version 2 -> 21
|
|
|
|
# v1.21.0 -> kube_version 3 -> 0
|
|
|
|
kube_version() {
|
|
|
|
echo "${KUBE_VERSION}" | sed 's/^v//' | cut -d'.' -f"${1}"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-28 08:32:33 +00:00
|
|
|
# detect if there is a minikube executable available already. If there is none,
|
|
|
|
# fallback to using /usr/local/bin/minikube, as that is where
|
|
|
|
# install_minikube() will place it too.
|
|
|
|
function detect_minikube() {
|
|
|
|
if type minikube >/dev/null 2>&1; then
|
|
|
|
command -v minikube
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# default if minikube is not available
|
|
|
|
echo '/usr/local/bin/minikube'
|
|
|
|
}
|
|
|
|
|
2019-05-22 05:50:53 +00:00
|
|
|
# install minikube
|
|
|
|
function install_minikube() {
|
2020-08-25 16:15:50 +00:00
|
|
|
if [[ "${MINIKUBE_VERSION}" == "latest" ]]; then
|
|
|
|
local mku_version
|
|
|
|
mku_version=$(${minikube} update-check 2> /dev/null | grep "LatestVersion" || true)
|
|
|
|
if [[ -n "${mku_version}" ]]; then
|
|
|
|
MINIKUBE_VERSION=$(echo "${mku_version}" | cut -d' ' -f2)
|
|
|
|
fi
|
2020-08-19 07:20:37 +00:00
|
|
|
fi
|
2020-08-25 16:15:50 +00:00
|
|
|
|
2020-07-28 08:32:33 +00:00
|
|
|
if type "${minikube}" >/dev/null 2>&1; then
|
2020-04-18 14:47:56 +00:00
|
|
|
local mk_version version
|
2020-07-28 08:32:33 +00:00
|
|
|
read -ra mk_version <<<"$(${minikube} version)"
|
2020-04-18 14:47:56 +00:00
|
|
|
version=${mk_version[2]}
|
2020-08-25 16:15:50 +00:00
|
|
|
if [[ "${version}" == "${MINIKUBE_VERSION}" ]]; then
|
|
|
|
echo "minikube already installed with ${version}"
|
2020-08-19 07:20:37 +00:00
|
|
|
return
|
|
|
|
fi
|
2019-05-22 05:50:53 +00:00
|
|
|
fi
|
|
|
|
|
2020-08-25 16:15:50 +00:00
|
|
|
echo "Installing minikube. Version: ${MINIKUBE_VERSION}"
|
2023-01-09 11:17:43 +00:00
|
|
|
curl -Lo minikube https://storage.googleapis.com/minikube/releases/"${MINIKUBE_VERSION}"/minikube-linux-"${MINIKUBE_ARCH}" && chmod +x minikube && sudo mv minikube /usr/local/bin/
|
2019-05-22 05:50:53 +00:00
|
|
|
}
|
|
|
|
|
2020-08-19 15:59:23 +00:00
|
|
|
function detect_kubectl() {
|
|
|
|
if type kubectl >/dev/null 2>&1; then
|
|
|
|
command -v kubectl
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# default if kubectl is not available
|
|
|
|
echo '/usr/local/bin/kubectl'
|
|
|
|
}
|
|
|
|
|
2019-05-22 05:50:53 +00:00
|
|
|
function install_kubectl() {
|
2020-08-19 15:59:23 +00:00
|
|
|
if type "${kubectl}" >/dev/null 2>&1; then
|
|
|
|
local kubectl_version
|
|
|
|
kubectl_version=$(kubectl version --client --short | cut -d' ' -f3)
|
|
|
|
if [[ "${kubectl_version}" == "${KUBE_VERSION}" ]]; then
|
|
|
|
echo "kubectl already installed with ${kubectl_version}"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
2019-05-22 05:50:53 +00:00
|
|
|
# Download kubectl, which is a requirement for using minikube.
|
|
|
|
echo "Installing kubectl. Version: ${KUBE_VERSION}"
|
2019-11-07 09:55:12 +00:00
|
|
|
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/"${KUBE_VERSION}"/bin/linux/"${MINIKUBE_ARCH}"/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/
|
2019-05-22 05:50:53 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 07:26:16 +00:00
|
|
|
function validate_container_cmd() {
|
2020-09-03 10:51:19 +00:00
|
|
|
local cmd="${CONTAINER_CMD##* }"
|
|
|
|
if [[ "${cmd}" == "docker" ]] || [[ "${cmd}" == "podman" ]]; then
|
|
|
|
if ! command -v "${cmd}" &> /dev/null; then
|
|
|
|
echo "'${cmd}' not found"
|
2020-09-03 07:26:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
2020-09-03 10:51:19 +00:00
|
|
|
echo "'CONTAINER_CMD' should be either docker or podman and not '${cmd}'"
|
2020-09-03 07:26:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-02-09 11:14:03 +00:00
|
|
|
# validate csi sidecar image version
|
|
|
|
function validate_sidecar() {
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
source "${SCRIPT_DIR}/../build.env"
|
|
|
|
|
|
|
|
sidecars=(CSI_ATTACHER_VERSION CSI_SNAPSHOTTER_VERSION CSI_PROVISIONER_VERSION CSI_RESIZER_VERSION CSI_NODE_DRIVER_REGISTRAR_VERSION)
|
|
|
|
for sidecar in "${sidecars[@]}"; do
|
|
|
|
if [[ -z "${!sidecar}" ]]; then
|
|
|
|
echo "${sidecar}" version is empty, make sure build.env has set this sidecar version
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-10-07 15:50:27 +00:00
|
|
|
# install_podman_wrapper creates /usr/bin/podman.wrapper which adds /sys
|
|
|
|
# filesystem mount points when a privileged container is started. This makes it
|
|
|
|
# possible to map RBD devices in the container that minikube creates when
|
|
|
|
# VM_DRIVER=podman is used.
|
|
|
|
function install_podman_wrapper() {
|
|
|
|
if [[ -e /usr/bin/podman.wrapper ]]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# disabled single quoted check, the script should be created as is
|
|
|
|
# shellcheck disable=SC2016
|
|
|
|
echo '#!/bin/sh
|
|
|
|
if [[ "${1}" = run ]]
|
|
|
|
then
|
|
|
|
if (echo "${@}" | grep -q privileged)
|
|
|
|
then
|
|
|
|
shift
|
|
|
|
exec /usr/bin/podman.real run -v /sys:/sys:rw -v /dev:/dev:rw --systemd=true "${@}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec /usr/bin/podman.real "${@}"
|
|
|
|
' > /usr/bin/podman.wrapper
|
|
|
|
chmod +x /usr/bin/podman.wrapper
|
|
|
|
|
|
|
|
mv /usr/bin/podman /usr/bin/podman.real
|
|
|
|
ln -s podman.wrapper /usr/bin/podman
|
|
|
|
}
|
|
|
|
|
2020-06-09 09:10:17 +00:00
|
|
|
# Storage providers and the default storage class is not needed for Ceph-CSI
|
|
|
|
# testing. In order to reduce resources and potential conflicts between storage
|
|
|
|
# plugins, disable them.
|
|
|
|
function disable_storage_addons() {
|
2020-07-28 08:32:33 +00:00
|
|
|
${minikube} addons disable default-storageclass 2>/dev/null || true
|
|
|
|
${minikube} addons disable storage-provisioner 2>/dev/null || true
|
2020-06-09 09:10:17 +00:00
|
|
|
}
|
|
|
|
|
2019-05-22 05:50:53 +00:00
|
|
|
# configure minikube
|
2019-11-07 09:55:12 +00:00
|
|
|
MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"}
|
2019-05-22 05:50:53 +00:00
|
|
|
MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"}
|
2022-08-26 17:57:12 +00:00
|
|
|
MINIKUBE_ISO_URL=${MINIKUBE_ISO_URL:-""}
|
2020-08-19 15:59:23 +00:00
|
|
|
KUBE_VERSION=${KUBE_VERSION:-"latest"}
|
2020-09-03 07:26:16 +00:00
|
|
|
CONTAINER_CMD=${CONTAINER_CMD:-"docker"}
|
2020-07-28 11:40:43 +00:00
|
|
|
MEMORY=${MEMORY:-"4096"}
|
2021-05-25 09:25:47 +00:00
|
|
|
MINIKUBE_WAIT_TIMEOUT=${MINIKUBE_WAIT_TIMEOUT:-"10m"}
|
2021-05-25 09:40:52 +00:00
|
|
|
MINIKUBE_WAIT=${MINIKUBE_WAIT:-"all"}
|
2020-08-04 07:04:46 +00:00
|
|
|
CPUS=${CPUS:-"$(nproc)"}
|
2019-05-22 05:50:53 +00:00
|
|
|
VM_DRIVER=${VM_DRIVER:-"virtualbox"}
|
2021-02-09 08:46:41 +00:00
|
|
|
CNI=${CNI:-"bridge"}
|
2021-09-15 05:16:38 +00:00
|
|
|
NUM_DISKS=${NUM_DISKS:-"1"}
|
2021-09-06 12:12:25 +00:00
|
|
|
DISK_SIZE=${DISK_SIZE:-"32g"}
|
2019-05-22 05:50:53 +00:00
|
|
|
#configure image repo
|
|
|
|
CEPHCSI_IMAGE_REPO=${CEPHCSI_IMAGE_REPO:-"quay.io/cephcsi"}
|
2022-04-19 16:28:04 +00:00
|
|
|
K8S_IMAGE_REPO=${K8S_IMAGE_REPO:-"registry.k8s.io/sig-storage"}
|
2019-12-03 12:36:15 +00:00
|
|
|
DISK="sda1"
|
|
|
|
if [[ "${VM_DRIVER}" == "kvm2" ]]; then
|
|
|
|
# use vda1 instead of sda1 when running with the libvirt driver
|
|
|
|
DISK="vda1"
|
|
|
|
fi
|
2021-09-06 12:12:25 +00:00
|
|
|
|
|
|
|
if [[ "${VM_DRIVER}" == "kvm2" ]] || [[ "${VM_DRIVER}" == "hyperkit" ]]; then
|
|
|
|
# adding extra disks is only supported on kvm2 and hyperkit
|
|
|
|
DISK_CONFIG=${DISK_CONFIG:-" --extra-disks=${NUM_DISKS} --disk-size=${DISK_SIZE} "}
|
|
|
|
else
|
|
|
|
DISK_CONFIG=""
|
|
|
|
fi
|
|
|
|
|
2022-08-26 17:57:12 +00:00
|
|
|
if [[ -n "${MINIKUBE_ISO_URL}" ]]; then
|
|
|
|
EXTRA_CONFIG="${EXTRA_CONFIG} --iso-url ${MINIKUBE_ISO_URL}"
|
|
|
|
fi
|
|
|
|
|
2022-01-20 15:06:07 +00:00
|
|
|
# configure csi image version
|
|
|
|
CSI_IMAGE_VERSION=${CSI_IMAGE_VERSION:-"canary"}
|
|
|
|
|
2019-05-22 05:50:53 +00:00
|
|
|
#feature-gates for kube
|
2021-11-02 08:39:00 +00:00
|
|
|
K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-""}
|
2019-05-22 05:50:53 +00:00
|
|
|
|
2020-06-02 14:52:53 +00:00
|
|
|
# kubelet.resolv-conf needs to point to a file, not a symlink
|
|
|
|
# the default minikube VM has /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
|
|
|
|
RESOLV_CONF='/run/systemd/resolve/resolv.conf'
|
2022-10-07 15:50:27 +00:00
|
|
|
if { [[ "${VM_DRIVER}" == "none" ]] || [[ "${VM_DRIVER}" == "podman" ]]; } && [[ ! -e "${RESOLV_CONF}" ]]; then
|
2020-06-02 14:52:53 +00:00
|
|
|
# in case /run/systemd/resolve/resolv.conf does not exist, use the
|
|
|
|
# standard /etc/resolv.conf (with symlink resolved)
|
|
|
|
RESOLV_CONF="$(readlink -f /etc/resolv.conf)"
|
|
|
|
fi
|
|
|
|
# TODO: this might overload --extra-config=kubelet.resolv-conf in case the
|
|
|
|
# caller did set EXTRA_CONFIG in the environment
|
|
|
|
EXTRA_CONFIG="${EXTRA_CONFIG} --extra-config=kubelet.resolv-conf=${RESOLV_CONF}"
|
2020-01-21 08:22:43 +00:00
|
|
|
|
2020-03-27 18:21:18 +00:00
|
|
|
#extra Rook configuration
|
|
|
|
ROOK_BLOCK_POOL_NAME=${ROOK_BLOCK_POOL_NAME:-"newrbdpool"}
|
2021-11-25 13:36:02 +00:00
|
|
|
ROOK_BLOCK_EC_POOL_NAME=${ROOK_BLOCK_EC_POOL_NAME:-"ec-pool"}
|
2020-03-27 18:21:18 +00:00
|
|
|
|
2021-01-14 07:47:57 +00:00
|
|
|
# enable read-only anonymous access to kubelet metrics
|
|
|
|
EXTRA_CONFIG="${EXTRA_CONFIG} --extra-config=kubelet.read-only-port=10255"
|
|
|
|
|
2020-08-19 15:59:23 +00:00
|
|
|
if [[ "${KUBE_VERSION}" == "latest" ]]; then
|
|
|
|
# update the version string from latest with the real version
|
|
|
|
KUBE_VERSION=$(curl -L https://storage.googleapis.com/kubernetes-release/release/stable.txt 2> /dev/null)
|
|
|
|
fi
|
|
|
|
|
2020-08-18 10:25:14 +00:00
|
|
|
minikube="$(detect_minikube)"
|
2020-08-19 15:59:23 +00:00
|
|
|
kubectl="$(detect_kubectl)"
|
2020-07-08 02:22:49 +00:00
|
|
|
|
2019-05-22 05:50:53 +00:00
|
|
|
case "${1:-}" in
|
|
|
|
up)
|
|
|
|
install_minikube
|
2019-06-02 09:49:24 +00:00
|
|
|
#if driver is 'none' install kubectl with KUBE_VERSION
|
2019-05-22 05:50:53 +00:00
|
|
|
if [[ "${VM_DRIVER}" == "none" ]]; then
|
|
|
|
mkdir -p "$HOME"/.kube "$HOME"/.minikube
|
|
|
|
install_kubectl
|
2022-10-07 15:50:27 +00:00
|
|
|
elif [[ "${VM_DRIVER}" == "podman" ]]; then
|
|
|
|
install_podman_wrapper
|
2019-05-22 05:50:53 +00:00
|
|
|
fi
|
|
|
|
|
2021-09-08 10:14:53 +00:00
|
|
|
# shellcheck disable=SC2086
|
2022-08-23 05:04:16 +00:00
|
|
|
${minikube} start --force --memory="${MEMORY}" --cpus="${CPUS}" -b kubeadm --kubernetes-version="${KUBE_VERSION}" --driver="${VM_DRIVER}" --feature-gates="${K8S_FEATURE_GATES}" --cni="${CNI}" ${EXTRA_CONFIG} --wait-timeout="${MINIKUBE_WAIT_TIMEOUT}" --wait="${MINIKUBE_WAIT}" --delete-on-failure ${DISK_CONFIG}
|
2023-08-24 08:48:29 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
${minikube} ssh "sudo sed -i 's/\(ExecStart=\/var.*\)/\1 --v=4/' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf"
|
|
|
|
${minikube} ssh "sudo systemctl daemon-reload"
|
|
|
|
${minikube} ssh "sudo systemctl restart kubelet"
|
|
|
|
${minikube} ssh "ps -Af |grep kubelet"
|
2019-05-22 05:50:53 +00:00
|
|
|
# create a link so the default dataDirHostPath will work for this
|
|
|
|
# environment
|
2022-10-07 15:50:27 +00:00
|
|
|
if [[ "${VM_DRIVER}" != "none" ]] && [[ "${VM_DRIVER}" != "podman" ]]; then
|
2019-05-22 05:50:53 +00:00
|
|
|
wait_for_ssh
|
|
|
|
# shellcheck disable=SC2086
|
2020-07-28 08:32:33 +00:00
|
|
|
${minikube} ssh "sudo mkdir -p /mnt/${DISK}/var/lib/rook;sudo ln -s /mnt/${DISK}/var/lib/rook /var/lib/rook"
|
2019-05-22 05:50:53 +00:00
|
|
|
fi
|
2022-10-07 15:50:27 +00:00
|
|
|
if [[ "${VM_DRIVER}" = "podman" ]]; then
|
|
|
|
${minikube} ssh "sudo mount -oremount,rw /sys"
|
|
|
|
fi
|
2023-10-09 11:14:46 +00:00
|
|
|
disable_storage_addons
|
2020-07-28 08:35:18 +00:00
|
|
|
${minikube} kubectl -- cluster-info
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
|
|
|
down)
|
2020-07-28 08:32:33 +00:00
|
|
|
${minikube} stop
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
|
|
|
ssh)
|
|
|
|
echo "connecting to minikube"
|
2020-07-28 08:32:33 +00:00
|
|
|
${minikube} ssh
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
2019-12-03 12:36:15 +00:00
|
|
|
deploy-rook)
|
|
|
|
echo "deploy rook"
|
2020-01-20 11:28:30 +00:00
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh deploy
|
2019-12-03 12:36:15 +00:00
|
|
|
;;
|
2020-10-13 11:46:48 +00:00
|
|
|
install-snapshotter)
|
|
|
|
echo "install snapshot controller"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/install-snapshot.sh install
|
|
|
|
;;
|
2020-03-27 18:21:18 +00:00
|
|
|
create-block-pool)
|
|
|
|
echo "creating a block pool named $ROOK_BLOCK_POOL_NAME"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh create-block-pool
|
|
|
|
;;
|
|
|
|
delete-block-pool)
|
|
|
|
echo "deleting block pool named $ROOK_BLOCK_POOL_NAME"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh delete-block-pool
|
|
|
|
;;
|
2021-11-25 13:36:02 +00:00
|
|
|
create-block-ec-pool)
|
|
|
|
echo "creating a erasure coded block pool named $ROOK_BLOCK_EC_POOL_NAME"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh create-block-ec-pool
|
|
|
|
;;
|
|
|
|
delete-block-ec-pool)
|
|
|
|
echo "deleting erasure coded block pool named $ROOK_BLOCK_EC_POOL_NAME"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh delete-block-ec-pool
|
|
|
|
;;
|
2020-10-13 11:46:48 +00:00
|
|
|
cleanup-snapshotter)
|
|
|
|
echo "cleanup snapshot controller"
|
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/install-snapshot.sh cleanup
|
|
|
|
;;
|
2019-12-03 12:36:15 +00:00
|
|
|
teardown-rook)
|
|
|
|
echo "teardown rook"
|
2020-01-20 11:28:30 +00:00
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
"$DIR"/rook.sh teardown
|
2019-12-03 12:36:15 +00:00
|
|
|
|
|
|
|
# delete rook data for minikube
|
2020-07-28 08:32:33 +00:00
|
|
|
${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"
|
2019-12-03 12:36:15 +00:00
|
|
|
;;
|
2019-05-22 05:50:53 +00:00
|
|
|
cephcsi)
|
2019-05-29 10:02:16 +00:00
|
|
|
echo "copying the cephcsi image"
|
2022-01-20 15:06:07 +00:00
|
|
|
copy_image_to_cluster "${CEPHCSI_IMAGE_REPO}"/cephcsi:"${CSI_IMAGE_VERSION}" "${CEPHCSI_IMAGE_REPO}"/cephcsi:"${CSI_IMAGE_VERSION}"
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
|
|
|
k8s-sidecar)
|
2022-02-09 11:14:03 +00:00
|
|
|
echo "validating sidecar's image version"
|
|
|
|
validate_sidecar
|
2019-05-22 05:50:53 +00:00
|
|
|
echo "copying the kubernetes sidecar images"
|
2021-06-29 04:55:11 +00:00
|
|
|
copy_image_to_cluster "${K8S_IMAGE_REPO}/csi-attacher:${CSI_ATTACHER_VERSION}" "${K8S_IMAGE_REPO}/csi-attacher:${CSI_ATTACHER_VERSION}"
|
|
|
|
copy_image_to_cluster "${K8S_IMAGE_REPO}/csi-snapshotter:${CSI_SNAPSHOTTER_VERSION}" "${K8S_IMAGE_REPO}/csi-snapshotter:${CSI_SNAPSHOTTER_VERSION}"
|
|
|
|
copy_image_to_cluster "${K8S_IMAGE_REPO}/csi-provisioner:${CSI_PROVISIONER_VERSION}" "${K8S_IMAGE_REPO}/csi-provisioner:${CSI_PROVISIONER_VERSION}"
|
|
|
|
copy_image_to_cluster "${K8S_IMAGE_REPO}/csi-node-driver-registrar:${CSI_NODE_DRIVER_REGISTRAR_VERSION}" "${K8S_IMAGE_REPO}/csi-node-driver-registrar:${CSI_NODE_DRIVER_REGISTRAR_VERSION}"
|
|
|
|
copy_image_to_cluster "${K8S_IMAGE_REPO}/csi-resizer:${CSI_RESIZER_VERSION}" "${K8S_IMAGE_REPO}/csi-resizer:${CSI_RESIZER_VERSION}"
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
|
|
|
clean)
|
2020-07-28 08:32:33 +00:00
|
|
|
${minikube} delete
|
2019-05-22 05:50:53 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " $0 [command]
|
|
|
|
Available Commands:
|
2020-10-13 11:46:48 +00:00
|
|
|
up Starts a local kubernetes cluster and prepare disk for rook
|
|
|
|
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
|
|
|
|
install-snapshotter Install snapshot controller
|
|
|
|
create-block-pool Creates a rook block pool (named $ROOK_BLOCK_POOL_NAME)
|
|
|
|
delete-block-pool Deletes a rook block pool (named $ROOK_BLOCK_POOL_NAME)
|
2021-11-25 13:36:02 +00:00
|
|
|
create-block-ec-pool Creates a rook erasure coded block pool (named $ROOK_BLOCK_EC_POOL_NAME)
|
|
|
|
delete-block-ec-pool Creates a rook erasure coded block pool (named $ROOK_BLOCK_EC_POOL_NAME)
|
2020-10-13 11:46:48 +00:00
|
|
|
cleanup-snapshotter Cleanup snapshot controller
|
|
|
|
teardown-rook Teardown rook from minikube
|
|
|
|
cephcsi Copy built docker images to kubernetes cluster
|
|
|
|
k8s-sidecar Copy kubernetes sidecar docker images to kubernetes cluster
|
2019-05-22 05:50:53 +00:00
|
|
|
" >&2
|
|
|
|
;;
|
|
|
|
esac
|