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

Commit 6cf4306

Browse files
authored
Merge pull request #5773 from fidencio/topic/CC-adapt-to-containerd-changes-in-the-kata-repo-versions-file
CC | Adapt to the containerd changes done on kata-containers repo
2 parents 6d7723a + 87c7140 commit 6cf4306

File tree

6 files changed

+187
-25
lines changed

6 files changed

+187
-25
lines changed

.ci/ci_job_flags.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ init_ci_flags() {
3737
# Build Kata for Confidential Containers
3838
# Values: "yes|no"
3939
export KATA_BUILD_CC="no"
40+
# Use the forked version of containerd for Confidential Containers
41+
# Valyes: "yes|no"
42+
export FORKED_CONTAINERD="no"
4043
# Hypervisor to use
4144
export KATA_HYPERVISOR=""
4245
# Install k8s
@@ -119,6 +122,7 @@ case "${CI_JOB}" in
119122
"CC_CRI_CONTAINERD"|"CC_CRI_CONTAINERD_K8S")
120123
# Export any CC specific environment variables
121124
export KATA_BUILD_CC="yes"
125+
export FORKED_CONTAINERD="yes"
122126
export MEASURED_ROOTFS="yes"
123127
export AA_KBC="offline_fs_kbc"
124128
if [[ "${CI_JOB}" =~ K8S ]]; then
@@ -133,6 +137,7 @@ case "${CI_JOB}" in
133137
export CRI_RUNTIME="containerd"
134138
export KATA_HYPERVISOR="qemu"
135139
export KATA_BUILD_CC="yes"
140+
export FORKED_CONTAINERD="yes"
136141
export AA_KBC="offline_fs_kbc"
137142
export TEST_INITRD="yes"
138143
if [[ "${CI_JOB}" =~ K8S ]]; then
@@ -155,6 +160,7 @@ case "${CI_JOB}" in
155160
export CRI_RUNTIME="containerd"
156161
export KATA_HYPERVISOR="qemu"
157162
export KATA_BUILD_CC="yes"
163+
export FORKED_CONTAINERD="yes"
158164
export MEASURED_ROOTFS="yes"
159165
export AA_KBC="cc_kbc"
160166
export TEE_TYPE="tdx"
@@ -174,6 +180,7 @@ case "${CI_JOB}" in
174180
export KUBERNETES="yes"
175181
export AA_KBC="offline_fs_kbc"
176182
export KATA_BUILD_CC="yes"
183+
export FORKED_CONTAINERD="yes"
177184
export MEASURED_ROOTFS="yes"
178185
if [[ "${CI_JOB}" =~ TDX ]]; then
179186
export TEE_TYPE="tdx"
@@ -199,6 +206,7 @@ case "${CI_JOB}" in
199206
export KATA_HYPERVISOR="cloud-hypervisor"
200207
# Export any CC specific environment variables
201208
export KATA_BUILD_CC="yes"
209+
export FORKED_CONTAINERD="yes"
202210
export MEASURED_ROOTFS="yes"
203211
export AA_KBC="offline_fs_kbc"
204212
;;

.ci/install_cri_containerd.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ source "${script_dir}/lib.sh"
2525
CONTAINERD_OS=$(go env GOOS)
2626
CONTAINERD_ARCH=$(go env GOARCH)
2727

28-
containerd_tarball_version=$(get_version "externals.containerd.version")
28+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
29+
containerd_tarball_version=$(get_version "externals.containerd.forked.version")
30+
else
31+
containerd_tarball_version=$(get_version "externals.containerd.upstream.version")
32+
fi
2933

3034
containerd_version=${containerd_tarball_version#v}
3135

@@ -38,7 +42,11 @@ fi
3842
install_from_source() {
3943
echo "Trying to install containerd from source"
4044
(
41-
containerd_repo=$(get_version "externals.containerd.url")
45+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
46+
containerd_repo=$(get_version "externals.containerd.forked.url")
47+
else
48+
containerd_repo=$(get_version "externals.containerd.upstream.url")
49+
fi
4250
cd ${GOPATH}/src/
4351
git clone "https://${containerd_repo}.git" "${GOPATH}/src/${containerd_repo}"
4452

@@ -55,7 +63,11 @@ install_from_source() {
5563

5664
install_from_static_tarball() {
5765
echo "Trying to install containerd from static tarball"
58-
local tarball_url=$(get_version "externals.containerd.tarball_url")
66+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
67+
local tarball_url=$(get_version "externals.containerd.forked.tarball_url")
68+
else
69+
local tarball_url=$(get_version "externals.containerd.upstream.tarball_url")
70+
fi
5971

6072
local tarball_name="cri-containerd-cni-${containerd_version}-${CONTAINERD_OS}-${CONTAINERD_ARCH}.tar.gz"
6173
local url="${tarball_url}/${containerd_tarball_version}/${tarball_name}"

integration/containerd/cri/integration-tests.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ source "${SCRIPT_PATH}/../../../.ci/lib.sh"
1818
# runc is installed in /usr/local/sbin/ add that path
1919
export PATH="$PATH:/usr/local/sbin"
2020

21-
containerd_tarball_version=$(get_version "externals.containerd.version")
21+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
22+
containerd_tarball_version=$(get_version "externals.containerd.forked.version")
23+
else
24+
containerd_tarball_version=$(get_version "externals.containerd.upstream.version")
25+
fi
2226

2327
# Runtime to be used for testing
2428
RUNTIME=${RUNTIME:-containerd-shim-kata-v2}
@@ -48,7 +52,11 @@ SNAP_CI=${SNAP_CI:-""}
4852
CI=${CI:-""}
4953

5054
containerd_shim_path="$(command -v containerd-shim)"
51-
readonly cri_containerd_repo=$(get_version "externals.containerd.url")
55+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
56+
readonly cri_containerd_repo=$(get_version "externals.containerd.forked.url")
57+
else
58+
readonly cri_containerd_repo=$(get_version "externals.containerd.upstream.url")
59+
fi
5260
readonly cri_containerd_repo_git="https://${cri_containerd_repo}.git"
5361

5462
#containerd config file
@@ -464,7 +472,11 @@ main() {
464472
git reset HEAD
465473

466474
# In CCv0 we are using a fork of containerd, so pull the matching branch of this
467-
containerd_branch=$(get_version "externals.containerd.branch")
475+
if [ "${FORKED_CONTAINERD}" = "yes" ]; then
476+
containerd_branch=$(get_version "externals.containerd.forked.branch")
477+
else
478+
containerd_branch=$(get_version "externals.containerd.upstream.version")
479+
fi
468480
git checkout "${containerd_branch}"
469481

470482
# switch to the default pause image set by containerd:1.6.x
@@ -522,4 +534,4 @@ main() {
522534
popd
523535
}
524536

525-
main
537+
main

integration/nydus/nydus_tests.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ containerd_config_backup="/tmp/containerd.config.toml"
3030
# test image for container
3131
IMAGE="${IMAGE:-ghcr.io/dragonflyoss/image-service/alpine:nydus-latest}"
3232

33-
if [ "$KATA_HYPERVISOR" != "qemu" ] && [ "$KATA_HYPERVISOR" != "cloud-hypervisor" ] && [ "$KATA_HYPERVISOR" != "dragonball" ]; then
34-
echo "Skip nydus test for $KATA_HYPERVISOR, it only works for QEMU/CLH/DB now."
33+
if [ "$KATA_HYPERVISOR" != "qemu" ] && [ "$KATA_HYPERVISOR" != "cloud-hypervisor" ]; then
34+
echo "Skip nydus test for $KATA_HYPERVISOR, it only works for QEMU/CLH. now."
3535
exit 0
3636
fi
3737

@@ -67,18 +67,12 @@ function setup_nydus() {
6767

6868
# Config nydus snapshotter
6969
sudo -E cp "$dir_path/nydusd-config.json" /etc/
70+
sudo -E cp "$dir_path/snapshotter-config.toml" /etc/
7071

7172
# start nydus-snapshotter
7273
nohup /usr/local/bin/containerd-nydus-grpc \
73-
--config-path /etc/nydusd-config.json \
74-
--shared-daemon \
75-
--log-level debug \
76-
--root /var/lib/containerd/io.containerd.snapshotter.v1.nydus \
77-
--cache-dir /var/lib/nydus/cache \
78-
--nydusd-path /usr/local/bin/nydusd \
79-
--nydusimg-path /usr/local/bin/nydus-image \
80-
--disable-cache-manager true \
81-
--enable-nydus-overlayfs true \
74+
--config /etc/snapshotter-config.toml \
75+
--nydusd-config /etc/nydusd-config.json \
8276
--log-to-stdout >/dev/null 2>&1 &
8377
}
8478

@@ -142,12 +136,22 @@ function config_containerd() {
142136
EOF
143137
}
144138

139+
function check_nydus_snapshotter_exist() {
140+
bin="containerd-nydus-grpc"
141+
if pgrep -f "$bin" >/dev/null; then
142+
echo "nydus-snapshotter is running"
143+
else
144+
die "nydus-snapshotter is not running"
145+
fi
146+
}
147+
145148
function setup() {
146149
setup_nydus
147150
config_kata
148151
config_containerd
149152
restart_containerd_service
150153
check_processes
154+
check_nydus_snapshotter_exist
151155
extract_kata_env
152156
}
153157

integration/nydus/nydusd-config.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
"backend": {
44
"type": "registry",
55
"config": {
6-
"scheme": "https",
76
"timeout": 5,
87
"connect_timeout": 5,
98
"retry_limit": 2
109
}
1110
},
1211
"cache": {
13-
"type": "blobcache",
14-
"config": {
15-
"work_dir": "/var/lib/nydus/cache"
16-
}
12+
"type": "blobcache"
1713
}
1814
},
1915
"mode": "direct",
@@ -22,6 +18,8 @@
2218
"enable_xattr": true,
2319
"fs_prefetch": {
2420
"enable": true,
25-
"threads_count": 2
21+
"threads_count": 8,
22+
"merging_size": 1048576,
23+
"prefetch_all": true
2624
}
27-
}
25+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
version = 1
2+
# Snapshotter's own home directory where it stores and creates necessary resources
3+
root = "/var/lib/containerd-nydus"
4+
# The snapshotter's GRPC server socket, containerd will connect to plugin on this socket
5+
address = "/run/containerd-nydus/containerd-nydus-grpc.sock"
6+
daemon_mode = "dedicated"
7+
# Whether snapshotter should try to clean up resources when it is closed
8+
cleanup_on_close = false
9+
10+
[system]
11+
# Snapshotter's debug and trace HTTP server interface
12+
enable = true
13+
# Unix domain socket path where system controller is listening on
14+
address = "/run/containerd-nydus/system.sock"
15+
16+
[system.debug]
17+
# Snapshotter can profile the CPU utilization of each nydusd daemon when it is being started.
18+
# This option specifies the profile duration when nydusd is downloading and uncomproessing data.
19+
daemon_cpu_profile_duration_secs = 5
20+
# Enable by assigning an address, empty indicates pprof server is disabled
21+
pprof_address = ""
22+
23+
[daemon]
24+
# Specify a configuration file for nydusd
25+
nydusd_config = "/etc/nydusd-config.json"
26+
nydusd_path = "/usr/local/bin/nydusd"
27+
nydusimage_path = "/usr/local/bin/nydus-image"
28+
# fusedev or fscache
29+
fs_driver = "fusedev"
30+
# How to process when daemon dies: "none", "restart" or "failover"
31+
recover_policy = "restart"
32+
# Nydusd worker thread number to handle FUSE or fscache requests, [0-1024].
33+
# Setting to 0 will use the default configuration of nydusd.
34+
threads_number = 4
35+
# Log rotation size for nydusd, in unit MB(megabytes)
36+
log_rotation_size = 100
37+
38+
39+
[cgroup]
40+
# Whether to use separate cgroup for nydusd.
41+
enable = true
42+
# The memory limit for nydusd cgroup, which contains all nydusd processes.
43+
# Percentage is supported as well, please ensure it is end with "%".
44+
# The default unit is bytes. Acceptable values include "209715200", "200MiB", "200Mi" and "10%".
45+
memory_limit = ""
46+
47+
[log]
48+
# Print logs to stdout rather than logging files
49+
log_to_stdout = false
50+
# Snapshotter's log level
51+
level = "info"
52+
log_rotation_compress = true
53+
log_rotation_local_time = true
54+
# Max number of days to retain logs
55+
log_rotation_max_age = 7
56+
log_rotation_max_backups = 5
57+
# In unit MB(megabytes)
58+
log_rotation_max_size = 100
59+
60+
[metrics]
61+
# Enable by assigning an address, empty indicates metrics server is disabled
62+
address = ":9110"
63+
64+
[remote]
65+
convert_vpc_registry = false
66+
67+
[remote.mirrors_config]
68+
# Snapshotter will overwrite daemon's mirrors configuration
69+
# if the values loaded from this driectory are not null before starting a daemon.
70+
# Set to "" or an empty directory to disable it.
71+
#dir = "/etc/nydus/certs.d"
72+
73+
[remote.auth]
74+
# Fetch the private registry auth by listening to K8s API server
75+
enable_kubeconfig_keychain = false
76+
# synchronize `kubernetes.io/dockerconfigjson` secret from kubernetes API server with specified kubeconfig (default `$KUBECONFIG` or `~/.kube/config`)
77+
kubeconfig_path = ""
78+
# Fetch the private registry auth as CRI image service proxy
79+
enable_cri_keychain = false
80+
# the target image service when using image proxy
81+
#image_service_address = "/run/containerd/containerd.sock"
82+
83+
[snapshot]
84+
# Let containerd use nydus-overlayfs mount helper
85+
enable_nydus_overlayfs = true
86+
# Insert Kata Virtual Volume option to `Mount.Options`
87+
enable_kata_volume = false
88+
# Whether to remove resources when a snapshot is removed
89+
sync_remove = false
90+
91+
[cache_manager]
92+
disable = false
93+
gc_period = "24h"
94+
# Directory to host cached files
95+
cache_dir = ""
96+
97+
[image]
98+
public_key_file = ""
99+
validate_signature = false
100+
101+
# The configuraions for features that are not production ready
102+
[experimental]
103+
# Whether to enable stargz support
104+
enable_stargz = false
105+
# Whether to enable referrers support
106+
# The option enables trying to fetch the Nydus image associated with the OCI image and run it.
107+
# Also see https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers
108+
enable_referrer_detect = false
109+
[experimental.tarfs]
110+
# Whether to enable nydus tarfs mode. Tarfs is supported by:
111+
# - The EROFS filesystem driver since Linux 6.4
112+
# - Nydus Image Service release v2.3
113+
enable_tarfs = false
114+
# Mount rafs on host by loopdev and EROFS
115+
mount_tarfs_on_host = false
116+
# Only enable nydus tarfs mode for images with `tarfs hint` label when true
117+
tarfs_hint = false
118+
# Maximum of concurrence to converting OCIv1 images to tarfs, 0 means default
119+
max_concurrent_proc = 0
120+
# Mode to export tarfs images:
121+
# - "none" or "": do not export tarfs
122+
# - "layer_verity_only": only generate disk verity information for a layer blob
123+
# - "image_verity_only": only generate disk verity information for all blobs of an image
124+
# - "layer_block": generate a raw block disk image with tarfs for a layer
125+
# - "image_block": generate a raw block disk image with tarfs for an image
126+
# - "layer_block_with_verity": generate a raw block disk image with tarfs for a layer with dm-verity info
127+
# - "image_block_with_verity": generate a raw block disk image with tarfs for an image with dm-verity info
128+
export_mode = ""

0 commit comments

Comments
 (0)