Skip to content

Commit

Permalink
cleanup nerdctl after nodeadm containerized build (#1599)
Browse files Browse the repository at this point in the history
* cleanup nerdctl after nodeadm containerized build

* use host network and only remove build and dangling imagest
  • Loading branch information
ndbaker1 authored Jan 30, 2024
1 parent dabe1f5 commit 8e9cddf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion templates/al2023/provisioners/install-nodeadm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@ 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 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
sudo mv $PROJECT_DIR/_bin/nodeadm /usr/bin/
Expand Down
9 changes: 9 additions & 0 deletions templates/al2023/provisioners/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8e9cddf

Please sign in to comment.