Skip to content

Commit

Permalink
pre-install: Use ctr from the host
Browse files Browse the repository at this point in the history
Let's take the same approach taken to use systemd and use ctr directly
from the host, which helps us to avoid actually mounting /run/ content
into our daemonset.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Nov 1, 2023
1 parent 51082d2 commit aa0ff73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions install/pre-install-payload/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,3 @@ COPY ${NYDUS_SNAPSHOTTER_ARTIFACTS} ${NODE_DESTINATION}/share/nydus-snapshotter/

ARG CONTAINER_ENGINE_ARTIFACTS=./scripts
COPY ${CONTAINER_ENGINE_ARTIFACTS}/* ${DESTINATION}/scripts/

# Also copy `ctr` to our final image, so we can use it to remove nydus snapshots
COPY --from=official-containerd-binary-downloader ${NODE_DESTINATION}/bin/ctr /usr/bin/ctr
8 changes: 6 additions & 2 deletions install/pre-install-payload/scripts/reqs-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ die() {
exit 1
}

function host_ctr() {
nsenter --target 1 --mount ctr "${@}"
}

function host_systemctl() {
nsenter --target 1 --mount systemctl "${@}"
}
Expand Down Expand Up @@ -112,8 +116,8 @@ function uninstall_containerd_artefacts() {

function uninstall_nydus_snapshotter_artefacts() {
if host_systemctl list-units | grep -q nydus-snapshotter; then
for i in `ctr -n k8s.io snapshot --snapshotter nydus list | grep -v KEY | cut -d' ' -f1`; do
ctr -n k8s.io snapshot --snapshotter nydus rm $i || true
for i in `host_ctr -n k8s.io snapshot --snapshotter nydus list | grep -v KEY | cut -d' ' -f1`; do
host_ctr -n k8s.io snapshot --snapshotter nydus rm $i || true
done

remove_nydus_snapshotter_from_containerd
Expand Down

0 comments on commit aa0ff73

Please sign in to comment.