diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0153f226..b4632ab0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -60,29 +60,33 @@ jobs: ./hack/test-smoke.sh multi-node: - name: "Multi node (emulated using LXD)" + name: "Multi node (emulated using Incus)" runs-on: ubuntu-22.04 timeout-minutes: 30 strategy: fail-fast: false matrix: include: - - lxc-image: ubuntu:22.04 + - incus-image: images:ubuntu/22.04 engine: docker - - lxc-image: images:fedora/39/cloud + - incus-image: images:fedora/39/cloud engine: podman env: - LXC_IMAGE: "${{ matrix.lxc-image }}" + INCUS_IMAGE: "${{ matrix.incus-image }}" CONTAINER_ENGINE: "${{ matrix.engine }}" steps: - run: sudo modprobe vxlan - uses: actions/checkout@v3 - - uses: canonical/setup-lxd@v0.1.1 - - run: ./hack/create-cluster-lxd.sh + - uses: maxwell-k/setup-incus@main + - name: "Set up Incus" + run: | + set -x + sudo incus admin init --auto + - run: ./hack/create-cluster-incus.sh - run: kubectl taint nodes --all node-role.kubernetes.io/control-plane- || true - run: ./hack/test-smoke.sh - name: "Test data persistency after restarting the node" run: | - lxc restart host0 host1 + sudo incus restart host0 host1 sleep 30 ./hack/test-smoke.sh diff --git a/hack/create-cluster-lxd.sh b/hack/create-cluster-incus.sh similarity index 95% rename from hack/create-cluster-lxd.sh rename to hack/create-cluster-incus.sh index e4a17b78..8d2f3872 100755 --- a/hack/create-cluster-lxd.sh +++ b/hack/create-cluster-incus.sh @@ -4,7 +4,7 @@ set -eux -o pipefail : "${CONTAINER_ENGINE:=docker}" # Create Rootless Docker hosts -./hack/create-hosts-lxd.sh "${HOME}/.u7s-ci-hosts" host0 host1 +./hack/create-hosts-incus.sh "${HOME}/.u7s-ci-hosts" host0 host1 SCP="scp -F ${HOME}/.u7s-ci-hosts/ssh_config" SSH="ssh -F ${HOME}/.u7s-ci-hosts/ssh_config" for host in host0 host1; do diff --git a/hack/create-hosts-lxd.sh b/hack/create-hosts-incus.sh similarity index 65% rename from hack/create-hosts-lxd.sh rename to hack/create-hosts-incus.sh index a85f1fcb..e71bdcc1 100755 --- a/hack/create-hosts-lxd.sh +++ b/hack/create-hosts-incus.sh @@ -8,8 +8,8 @@ dir=$1 shift names=$* -: "${LXC_IMAGE:="ubuntu:22.04"}" -LXC="sudo lxc" +: "${INCUS_IMAGE:="images:ubuntu/22.04"}" +INCUS="sudo incus" echo "USER=${USER}" ssh_config="${dir}/ssh_config" @@ -43,12 +43,16 @@ EOF fi for name in ${names}; do - ${LXC} init "${LXC_IMAGE}" "${name}" -c security.privileged=true -c security.nesting=true - ${LXC} config device add "${name}" bind-boot disk source=/boot path=/boot readonly=true - ${LXC} config set "${name}" user.user-data - <"${userdata}" - ${LXC} start "${name}" + ${INCUS} init "${INCUS_IMAGE}" "${name}" -c security.privileged=true -c security.nesting=true + ${INCUS} config device add "${name}" bind-boot disk source=/boot path=/boot readonly=true + ${INCUS} config set "${name}" user.user-data - <"${userdata}" + ${INCUS} start "${name}" sleep 10 - ip="$(${LXC} exec "${name}" -- ip --json route get 1 | jq -r .[0].prefsrc)" + if ${INCUS} exec "${name}" -- apt-get --help >/dev/null 2>&1; then + ${INCUS} exec "${name}" -- apt-get update + ${INCUS} exec "${name}" -- apt-get install -y openssh-server + fi + ip="$(${INCUS} exec "${name}" -- ip --json route get 1 | jq -r .[0].prefsrc)" echo "Host ${name}" >>"${ssh_config}" echo " Hostname ${ip}" >>"${ssh_config}" echo " # For a test env, the host key can be just ignored" diff --git a/init-host/init-host.root.sh b/init-host/init-host.root.sh index 5151eb17..b65c0fb0 100755 --- a/init-host/init-host.root.sh +++ b/init-host/init-host.root.sh @@ -22,7 +22,7 @@ cat >/etc/modules-load.d/usernetes.conf </etc/sysctl.d/99-usernetes.conf </etc/sysctl.d/99-usernetes.conf </dev/null 2>&1; then dnf install -y git shadow-utils make jq - # Workaround: SUID bit on newuidmap is dropped on LXC images:fedora/38/cloud, + # Workaround: SUID bit on newuidmap is dropped on Incus images:fedora/38/cloud, # so it has to be reinstalled dnf reinstall -y shadow-utils else