ci: use the host /sbin/losetup in minikube VM

minikube has /sbin/losetup from Busybox, and that does not work with
raw-block PVCs. Use the losetup executable from the host in the VM
instead.

See-also: kubernetes/minikube#8284
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-07-28 16:02:42 +02:00 committed by mergify[bot]
parent 230dd67752
commit fb60f66178

View File

@ -88,6 +88,17 @@ function disable_storage_addons() {
${minikube} addons disable storage-provisioner 2>/dev/null || true ${minikube} addons disable storage-provisioner 2>/dev/null || true
} }
# minikube has the Busybox losetup, and that does not work with raw-block PVCs.
# Copy the host losetup executable and hope it works.
#
# See https://github.com/kubernetes/minikube/issues/8284
function minikube_losetup() {
# scp should not ask for any confirmation
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "$(${minikube} ssh-key)" /sbin/losetup docker@"$(${minikube} ip)":losetup
# replace /sbin/losetup symlink with the executable
${minikube} ssh 'sudo sh -c "rm -f /sbin/losetup && cp ~docker/losetup /sbin"'
}
# configure minikube # configure minikube
MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"} MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"}
MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"} MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"}
@ -170,6 +181,7 @@ up)
wait_for_ssh wait_for_ssh
# shellcheck disable=SC2086 # shellcheck disable=SC2086
${minikube} ssh "sudo mkdir -p /mnt/${DISK}/var/lib/rook;sudo ln -s /mnt/${DISK}/var/lib/rook /var/lib/rook" ${minikube} ssh "sudo mkdir -p /mnt/${DISK}/var/lib/rook;sudo ln -s /mnt/${DISK}/var/lib/rook /var/lib/rook"
minikube_losetup
fi fi
${minikube} kubectl -- cluster-info ${minikube} kubectl -- cluster-info
;; ;;