ci: make minikube.sh work on macOS M1 with the qemu2 driver

To utilize minikube on macOS M1, the qemu2 VM driver is currently the
only viable option. Therefore, the following modifications have been
implemented:
* the RESOLV_CONF variable has been made configurable because it needs
to be overridden as /etc/resolv.conf when using the qemu2 driver.
* adding additional disks when using the qemu2 driver.

Signed-off-by: zjx20 <zhoujianxiong2@gmail.com>
This commit is contained in:
zjx20 2024-08-30 10:05:51 +08:00 committed by mergify[bot]
parent d3733a0e6a
commit 49926446f9

View File

@ -200,7 +200,7 @@ if [[ "${VM_DRIVER}" == "kvm2" ]]; then
DISK="vda1"
fi
if [[ "${VM_DRIVER}" == "kvm2" ]] || [[ "${VM_DRIVER}" == "hyperkit" ]]; then
if [[ "${VM_DRIVER}" == "kvm2" ]] || [[ "${VM_DRIVER}" == "hyperkit" ]] || [[ "${VM_DRIVER}" == "qemu2" ]]; then
# adding extra disks is only supported on kvm2 and hyperkit
DISK_CONFIG=${DISK_CONFIG:-" --extra-disks=${NUM_DISKS} --disk-size=${DISK_SIZE} "}
else
@ -219,7 +219,7 @@ K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-""}
# 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'
RESOLV_CONF="${RESOLV_CONF:-/run/systemd/resolve/resolv.conf}"
if { [[ "${VM_DRIVER}" == "none" ]] || [[ "${VM_DRIVER}" == "podman" ]]; } && [[ ! -e "${RESOLV_CONF}" ]]; then
# in case /run/systemd/resolve/resolv.conf does not exist, use the
# standard /etc/resolv.conf (with symlink resolved)