diff --git a/scripts/minikube.sh b/scripts/minikube.sh index ae5cdd8e6..faf9c8643 100755 --- a/scripts/minikube.sh +++ b/scripts/minikube.sh @@ -115,13 +115,6 @@ function validate_container_cmd() { fi } -function enable_psp() { - echo "prepare minikube to support pod security policies" - mkdir -p "$HOME"/.minikube/files/etc/kubernetes/addons - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - cp "$DIR"/psp.yaml "$HOME"/.minikube/files/etc/kubernetes/addons/psp.yaml -} - # 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. @@ -130,19 +123,6 @@ function disable_storage_addons() { ${minikube} addons disable storage-provisioner 2>/dev/null || true } -function minikube_supports_psp() { - local MINIKUBE_MAJOR - local MINIKUBE_MINOR - local MINIKUBE_PATCH - MINIKUBE_MAJOR=$(minikube_version 1) - MINIKUBE_MINOR=$(minikube_version 2) - MINIKUBE_PATCH=$(minikube_version 3) - if [[ "${MINIKUBE_MAJOR}" -ge 1 ]] && [[ "${MINIKUBE_MINOR}" -ge 11 ]] && [[ "${MINIKUBE_PATCH}" -ge 1 ]] || [[ "${MINIKUBE_MAJOR}" -ge 1 ]] && [[ "${MINIKUBE_MINOR}" -ge 12 ]]; then - return 1 - fi - return 0 -} - # configure minikube MINIKUBE_ARCH=${MINIKUBE_ARCH:-"amd64"} MINIKUBE_VERSION=${MINIKUBE_VERSION:-"latest"} @@ -222,21 +202,8 @@ up) disable_storage_addons - echo "starting minikube with kubeadm bootstrapper" - if minikube_supports_psp; then - enable_psp - # shellcheck disable=SC2086 - ${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} ${EXTRA_CONFIG_PSP} --wait-timeout="${MINIKUBE_WAIT_TIMEOUT}" --wait="${MINIKUBE_WAIT}" --delete-on-failure ${DISK_CONFIG} - else - # This is a workaround to fix psp issues in minikube >1.6.2 and <1.11.0 - # shellcheck disable=SC2086 - ${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} - DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" - ${minikube} kubectl -- apply -f "$DIR"/psp.yaml - ${minikube} stop - # shellcheck disable=SC2086 - ${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} ${EXTRA_CONFIG_PSP} --wait-timeout="${MINIKUBE_WAIT_TIMEOUT}" --wait="${MINIKUBE_WAIT}" ${DISK_CONFIG} - fi + # shellcheck disable=SC2086 + ${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} ${EXTRA_CONFIG_PSP} --wait-timeout="${MINIKUBE_WAIT_TIMEOUT}" --wait="${MINIKUBE_WAIT}" --delete-on-failure ${DISK_CONFIG} # create a link so the default dataDirHostPath will work for this # environment