mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 11:50:18 +00:00
ci: add a way to supply CONTAINER_CMD of choice
Add a way to supply local CONTAINER_CMD option of choice via env variable to minikube.sh Note: we still use docker daemon env at minikube box, in the future we can switch to podman service env '# minikube podman-env' if needed Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
parent
f2edc926cf
commit
6fa7b74138
@ -18,14 +18,15 @@ function wait_for_ssh() {
|
|||||||
function copy_image_to_cluster() {
|
function copy_image_to_cluster() {
|
||||||
local build_image=$1
|
local build_image=$1
|
||||||
local final_image=$2
|
local final_image=$2
|
||||||
if [ -z "$(docker images -q "${build_image}")" ]; then
|
validate_container_cmd
|
||||||
docker pull "${build_image}"
|
if [ -z "$(${CONTAINER_CMD} images -q "${build_image}")" ]; then
|
||||||
|
${CONTAINER_CMD} pull "${build_image}"
|
||||||
fi
|
fi
|
||||||
if [[ "${VM_DRIVER}" == "none" ]]; then
|
if [[ "${VM_DRIVER}" == "none" ]]; then
|
||||||
docker tag "${build_image}" "${final_image}"
|
${CONTAINER_CMD} tag "${build_image}" "${final_image}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
docker save "${build_image}" | (eval "$(${minikube} docker-env --shell bash)" && docker load && docker tag "${build_image}" "${final_image}")
|
${CONTAINER_CMD} save "${build_image}" | (eval "$(${minikube} docker-env --shell bash)" && docker load && docker tag "${build_image}" "${final_image}")
|
||||||
}
|
}
|
||||||
|
|
||||||
# parse the minikube version, return the digit passed as argument
|
# parse the minikube version, return the digit passed as argument
|
||||||
@ -95,6 +96,18 @@ function install_kubectl() {
|
|||||||
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/
|
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/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validate_container_cmd() {
|
||||||
|
if [[ "${CONTAINER_CMD}" == "docker" ]] || [[ "${CONTAINER_CMD}" == "podman" ]]; then
|
||||||
|
if ! command -v "${CONTAINER_CMD}" &> /dev/null; then
|
||||||
|
echo "'${CONTAINER_CMD}' not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "'CONTAINER_CMD' should be either docker or podman and not '${CONTAINER_CMD}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function enable_psp() {
|
function enable_psp() {
|
||||||
echo "prepare minikube to support pod security policies"
|
echo "prepare minikube to support pod security policies"
|
||||||
mkdir -p "$HOME"/.minikube/files/etc/kubernetes/addons
|
mkdir -p "$HOME"/.minikube/files/etc/kubernetes/addons
|
||||||
@ -138,6 +151,7 @@ function minikube_supports_psp() {
|
|||||||
MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"}
|
MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"}
|
||||||
MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"}
|
MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"}
|
||||||
KUBE_VERSION=${KUBE_VERSION:-"latest"}
|
KUBE_VERSION=${KUBE_VERSION:-"latest"}
|
||||||
|
CONTAINER_CMD=${CONTAINER_CMD:-"docker"}
|
||||||
MEMORY=${MEMORY:-"4096"}
|
MEMORY=${MEMORY:-"4096"}
|
||||||
CPUS=${CPUS:-"$(nproc)"}
|
CPUS=${CPUS:-"$(nproc)"}
|
||||||
VM_DRIVER=${VM_DRIVER:-"virtualbox"}
|
VM_DRIVER=${VM_DRIVER:-"virtualbox"}
|
||||||
|
Loading…
Reference in New Issue
Block a user