From 4eaa091aee1655369a59a30114bb9cb11c131fe6 Mon Sep 17 00:00:00 2001 From: vsoch Date: Fri, 21 Feb 2025 08:10:06 -0700 Subject: [PATCH] ci: add test for rootful docker This is important to run on multi-node Signed-off-by: vsoch --- .github/workflows/main.yaml | 2 ++ hack/create-cluster-lima.sh | 6 ++++++ init-host/init-host.root.sh | 3 +++ init-host/init-host.rootless.sh | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7efb874..c8efda0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,6 +20,8 @@ jobs: include: - lima_template: template://ubuntu-24.04 container_engine: docker + - lima_template: template://docker-rootful + container_engine: docker-rootful - lima_template: template://ubuntu-24.04 container_engine: nerdctl - lima_template: template://centos-stream-9 diff --git a/hack/create-cluster-lima.sh b/hack/create-cluster-lima.sh index ba3d230..6efbcf6 100755 --- a/hack/create-cluster-lima.sh +++ b/hack/create-cluster-lima.sh @@ -37,6 +37,12 @@ done SERVICE_PORTS="PORT_KUBE_APISERVER=${PORT_KUBE_APISERVER} PORT_ETCD=${PORT_ETCD} PORT_FLANNEL=${PORT_FLANNEL} PORT_KUBELET=${PORT_KUBELET}" +# At this point, rootless / rootful Docker is setup +if [[ "$CONTAINER_ENGINE" == "docker-rootful" ]] + then + CONTAINER_ENGINE="docker" +fi + # Launch a Kubernetes node inside a Rootless Docker host for host in host0 host1; do ${LIMACTL} shell "${host}" ${SERVICE_PORTS} CONTAINER_ENGINE="${CONTAINER_ENGINE}" make -C "${guest_home}/usernetes" up diff --git a/init-host/init-host.root.sh b/init-host/init-host.root.sh index 911ec70..060c288 100755 --- a/init-host/init-host.root.sh +++ b/init-host/init-host.root.sh @@ -77,6 +77,9 @@ case "${CONTAINER_ENGINE}" in fi systemctl disable --now docker ;; +"docker-rootful") + echo "Preparing to run docker in default rootful mode." + ;; "podman") if ! command -v podman-compose >/dev/null 2>&1; then "${script_dir}"/init-host.root.d/install-podman.sh diff --git a/init-host/init-host.rootless.sh b/init-host/init-host.rootless.sh index 1151fe1..fe549a1 100755 --- a/init-host/init-host.rootless.sh +++ b/init-host/init-host.rootless.sh @@ -12,6 +12,10 @@ case "${CONTAINER_ENGINE}" in "docker") dockerd-rootless-setuptool.sh install || (journalctl --user --since "10 min ago"; exit 1) ;; +"docker-rootful") + echo "Skipping rootless install of docker" + CONTAINER_ENGINE="docker" + ;; "nerdctl") containerd-rootless-setuptool.sh install containerd-rootless-setuptool.sh install-buildkit-containerd