Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit c070c2a

Browse files
committed
ci: containerd_nydus_setup
Ensure nydus is setup to be used by containerd as part of our tests. Signed-off-by: Fabiano Fidêncio <[email protected]> Signed-off-by: ChengyuZhu6 <[email protected]>
1 parent 336f44b commit c070c2a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.ci/containerd_nydus_setup.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2023 Intel Corporation
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
set -o errexit
9+
set -o nounset
10+
set -o pipefail
11+
12+
cidir=$(dirname "$0")
13+
source "${cidir}/../lib/common.bash"
14+
15+
# Nydus related configurations
16+
NYDUS_SNAPSHOTTER_BINARY="/usr/local/bin/containerd-nydus-grpc"
17+
NYDUS_SNAPSHOTTER_TARFS_CONFIG="/usr/local/share/nydus-snapshotter/config-coco-host-sharing.toml"
18+
NYDUS_SNAPSHOTTER_GUEST_CONFIG="/usr/local/share/nydus-snapshotter/config-coco-guest-pulling.toml"
19+
NYDUS_SNAPSHOTTER_CONFIG="${NYDUS_SNAPSHOTTER_CONFIG:-${NYDUS_SNAPSHOTTER_TARFS_CONFIG}}"
20+
NYDUS_SNAPSHOTTER_TARFS_EXPORT_MODE="${NYDUS_SNAPSHOTTER_TARFS_EXPORT_MODE:-image_block}"
21+
22+
echo "Configure nydus snapshotter"
23+
if [ "${IMAGE_OFFLOAD_TO_GUEST:-"no"}" == "yes" ]; then
24+
NYDUS_SNAPSHOTTER_CONFIG="${NYDUS_SNAPSHOTTER_GUEST_CONFIG}"
25+
else
26+
NYDUS_SNAPSHOTTER_CONFIG="${NYDUS_SNAPSHOTTER_TARFS_CONFIG}"
27+
sudo sed -i "s/export_mode = .*/export_mode = \"${NYDUS_SNAPSHOTTER_TARFS_EXPORT_MODE}\"/" "$NYDUS_SNAPSHOTTER_CONFIG"
28+
fi
29+
30+
echo "Start nydus snapshotter"
31+
sudo "${NYDUS_SNAPSHOTTER_BINARY}" --config "${NYDUS_SNAPSHOTTER_CONFIG}" >/dev/stdout 2>&1 &
32+
33+
echo "Configure containerd to use the nydus snapshotter"
34+
35+
containerd_config_dir="/etc/containerd"
36+
containerd_config_file="${containerd_config_dir}/config.toml"
37+
38+
snapshotter_socket="/run/containerd-nydus/containerd-nydus-grpc.sock"
39+
proxy_config=" [proxy_plugins.nydus]\n type = \"snapshot\"\n address = \"${snapshotter_socket}\""
40+
snapshotter_config=" disable_snapshot_annotations = false\n snapshotter = \"nydus\""
41+
42+
# We're assuming here to be working on a clean VM.
43+
echo -e "[proxy_plugins]" | sudo tee -a "${containerd_config_file}"
44+
echo -e "${proxy_config}" | sudo tee -a "${containerd_config_file}"
45+
sudo sed -i '/\[plugins.cri.containerd\]/a\'"${snapshotter_config}" "${containerd_config_file}"
46+
47+
restart_containerd_service

.ci/setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ install_extra_tools() {
138138
if [ "${IMAGE_OFFLOAD_TO_GUEST}" == "yes" ]; then
139139
info "Install nydus-snapshotter"
140140
bash -f "${cidir}/install_nydus_snapshotter.sh"
141+
bash -f "${cidir}/containerd_nydus_setup.sh"
141142
fi
142143

143144
echo "Install CNI plugins"

0 commit comments

Comments
 (0)