From 4700fa1e343fc831c255589ff2923094bdbd059f Mon Sep 17 00:00:00 2001 From: Nick Baker Date: Tue, 30 Jan 2024 00:07:48 +0000 Subject: [PATCH] use host network and only remove build and dangling imagest --- templates/al2023/provisioners/install-nodeadm.sh | 13 +++++++++---- templates/al2023/provisioners/validate.sh | 9 +++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/templates/al2023/provisioners/install-nodeadm.sh b/templates/al2023/provisioners/install-nodeadm.sh index e20ce97b5..7decc723b 100644 --- a/templates/al2023/provisioners/install-nodeadm.sh +++ b/templates/al2023/provisioners/install-nodeadm.sh @@ -4,18 +4,23 @@ set -o pipefail set -o nounset set -o errexit +BUILD_IMAGE=public.ecr.aws/eks-distro-build-tooling/golang:1.21 + sudo systemctl start containerd sudo nerdctl run \ --rm \ + --network host \ --workdir /workdir \ --volume $PROJECT_DIR:/workdir \ - public.ecr.aws/eks-distro-build-tooling/golang:1.21 \ + $BUILD_IMAGE \ make build -# cleanup images and networks used for nerdctl -sudo nerdctl image prune --all --force -sudo nerdctl network rm $(sudo nerdctl network list -q) +# cleanup build image and snapshots +sudo nerdctl rmi \ + --force \ + $BUILD_IMAGE \ + $(sudo nerdctl images -a | grep none | awk '{ print $3 }') # move the nodeadm binary into bin folder sudo chmod a+x $PROJECT_DIR/_bin/nodeadm diff --git a/templates/al2023/provisioners/validate.sh b/templates/al2023/provisioners/validate.sh index 3179039ab..8569772d1 100644 --- a/templates/al2023/provisioners/validate.sh +++ b/templates/al2023/provisioners/validate.sh @@ -52,3 +52,12 @@ if [ ${FREE_MEBIBYTES} -lt ${REQUIRED_FREE_MEBIBYTES} ]; then else echo "Disk space requirements were met." fi + +################################ +### network #################### +################################ + +if sudo ip link | grep nerdctl0; then + echo "nerdctl0 interface should be removed." + exit 1 +fi