Skip to content

Commit a2302ea

Browse files
dmcgowank8s-infra-cherrypick-robot
authored andcommitted
Add integration test for custom configuration
Signed-off-by: Derek McGowan <[email protected]>
1 parent be5eda0 commit a2302ea

File tree

2 files changed

+334
-1
lines changed

2 files changed

+334
-1
lines changed

integration/client/migration_test.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ package client
1818

1919
import (
2020
"bytes"
21+
"fmt"
2122
"os"
2223
"os/exec"
2324
"path/filepath"
25+
"regexp"
2426
"runtime"
2527
"strings"
2628
"testing"
@@ -62,6 +64,17 @@ func TestMigration(t *testing.T) {
6264
File: "testdata/default-1.7.toml",
6365
Migrated: defaultContent,
6466
},
67+
{
68+
Name: "1.7-Custom",
69+
File: "testdata/custom-1.7.toml",
70+
Migrated: replaceAllValues(defaultContent, map[string]string{
71+
"sandbox": "'custom.io/pause:3.10'",
72+
"stream_idle_timeout": "'2h0m0s'",
73+
"stream_server_address": "'127.0.1.1'",
74+
"stream_server_port": "'15000'",
75+
"enable_tls_streaming": "true",
76+
}),
77+
},
6578
}...)
6679
}
6780

@@ -74,7 +87,7 @@ func TestMigration(t *testing.T) {
7487
cmd.Stderr = os.Stderr
7588
require.NoError(t, cmd.Run())
7689
actual := buf.String()
77-
assert.Equal(t, tc.Migrated, actual)
90+
assert.Equal(t, tc.Migrated, actual, "Actual (full)\n%s", tc.Migrated, actual)
7891
})
7992
}
8093

@@ -90,3 +103,15 @@ func currentDefaultConfig() (string, error) {
90103
}
91104
return buf.String(), nil
92105
}
106+
107+
func replaceAllValues(src string, values map[string]string) string {
108+
for k, v := range values {
109+
src = replaceValue(src, k, v)
110+
}
111+
return src
112+
}
113+
114+
func replaceValue(src, key, value string) string {
115+
re := regexp.MustCompile(fmt.Sprintf(`(\s*)%s = [^\n]*`, key))
116+
return re.ReplaceAllString(src, fmt.Sprintf(`${1}%s = %s`, key, value))
117+
}
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
disabled_plugins = []
2+
imports = []
3+
oom_score = 0
4+
plugin_dir = ""
5+
required_plugins = []
6+
root = "/var/lib/containerd"
7+
state = "/run/containerd"
8+
temp = ""
9+
version = 2
10+
11+
[cgroup]
12+
path = ""
13+
14+
[debug]
15+
address = ""
16+
format = ""
17+
gid = 0
18+
level = ""
19+
uid = 0
20+
21+
[grpc]
22+
address = "/run/containerd/containerd.sock"
23+
gid = 0
24+
max_recv_message_size = 16777216
25+
max_send_message_size = 16777216
26+
tcp_address = ""
27+
tcp_tls_ca = ""
28+
tcp_tls_cert = ""
29+
tcp_tls_key = ""
30+
uid = 0
31+
32+
[metrics]
33+
address = ""
34+
grpc_histogram = false
35+
36+
[plugins]
37+
38+
[plugins."io.containerd.gc.v1.scheduler"]
39+
deletion_threshold = 0
40+
mutation_threshold = 100
41+
pause_threshold = 0.02
42+
schedule_delay = "0s"
43+
startup_delay = "100ms"
44+
45+
[plugins."io.containerd.grpc.v1.cri"]
46+
cdi_spec_dirs = ["/etc/cdi", "/var/run/cdi"]
47+
device_ownership_from_security_context = false
48+
disable_apparmor = false
49+
disable_cgroup = false
50+
disable_hugetlb_controller = true
51+
disable_proc_mount = false
52+
disable_tcp_service = true
53+
drain_exec_sync_io_timeout = "0s"
54+
# Updated in latest release
55+
#enable_cdi = false
56+
enable_cdi = true
57+
enable_selinux = false
58+
enable_tls_streaming = true
59+
# Updated in latest release
60+
#enable_unprivileged_icmp = false
61+
#enable_unprivileged_ports = false
62+
enable_unprivileged_icmp = true
63+
enable_unprivileged_ports = true
64+
ignore_image_defined_volumes = false
65+
image_pull_progress_timeout = "5m0s"
66+
max_concurrent_downloads = 3
67+
max_container_log_line_size = 16384
68+
netns_mounts_under_state_dir = false
69+
restrict_oom_score_adj = false
70+
sandbox_image = "custom.io/pause:3.10"
71+
selinux_category_range = 1024
72+
stats_collect_period = 10
73+
stream_idle_timeout = "2h0m0s"
74+
stream_server_address = "127.0.1.1"
75+
stream_server_port = "15000"
76+
systemd_cgroup = false
77+
tolerate_missing_hugetlb_controller = true
78+
unset_seccomp_profile = ""
79+
80+
[plugins."io.containerd.grpc.v1.cri".cni]
81+
bin_dir = "/opt/cni/bin"
82+
conf_dir = "/etc/cni/net.d"
83+
conf_template = ""
84+
ip_pref = ""
85+
max_conf_num = 1
86+
setup_serially = false
87+
88+
[plugins."io.containerd.grpc.v1.cri".containerd]
89+
default_runtime_name = "runc"
90+
disable_snapshot_annotations = true
91+
discard_unpacked_layers = false
92+
ignore_blockio_not_enabled_errors = false
93+
ignore_rdt_not_enabled_errors = false
94+
no_pivot = false
95+
snapshotter = "overlayfs"
96+
97+
[plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]
98+
base_runtime_spec = ""
99+
cni_conf_dir = ""
100+
cni_max_conf_num = 0
101+
container_annotations = []
102+
pod_annotations = []
103+
privileged_without_host_devices = false
104+
privileged_without_host_devices_all_devices_allowed = false
105+
runtime_engine = ""
106+
runtime_path = ""
107+
runtime_root = ""
108+
runtime_type = ""
109+
sandbox_mode = ""
110+
snapshotter = ""
111+
112+
[plugins."io.containerd.grpc.v1.cri".containerd.default_runtime.options]
113+
114+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
115+
116+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
117+
base_runtime_spec = ""
118+
cni_conf_dir = ""
119+
cni_max_conf_num = 0
120+
container_annotations = []
121+
pod_annotations = []
122+
privileged_without_host_devices = false
123+
privileged_without_host_devices_all_devices_allowed = false
124+
runtime_engine = ""
125+
runtime_path = ""
126+
runtime_root = ""
127+
runtime_type = "io.containerd.runc.v2"
128+
sandbox_mode = "podsandbox"
129+
snapshotter = ""
130+
131+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
132+
BinaryName = ""
133+
CriuImagePath = ""
134+
CriuWorkPath = ""
135+
IoGid = 0
136+
IoUid = 0
137+
NoNewKeyring = false
138+
Root = ""
139+
ShimCgroup = ""
140+
# Removed in latest
141+
#CriuPath = ""
142+
#NoPivotRoot = false
143+
#SystemdCgroup = false
144+
145+
[plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime]
146+
base_runtime_spec = ""
147+
cni_conf_dir = ""
148+
cni_max_conf_num = 0
149+
container_annotations = []
150+
pod_annotations = []
151+
privileged_without_host_devices = false
152+
privileged_without_host_devices_all_devices_allowed = false
153+
runtime_engine = ""
154+
runtime_path = ""
155+
runtime_root = ""
156+
runtime_type = ""
157+
sandbox_mode = ""
158+
snapshotter = ""
159+
160+
[plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime.options]
161+
162+
[plugins."io.containerd.grpc.v1.cri".image_decryption]
163+
key_model = "node"
164+
165+
[plugins."io.containerd.grpc.v1.cri".registry]
166+
config_path = ""
167+
168+
[plugins."io.containerd.grpc.v1.cri".registry.auths]
169+
170+
[plugins."io.containerd.grpc.v1.cri".registry.configs]
171+
172+
[plugins."io.containerd.grpc.v1.cri".registry.headers]
173+
174+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
175+
176+
[plugins."io.containerd.grpc.v1.cri".x509_key_pair_streaming]
177+
tls_cert_file = ""
178+
tls_key_file = ""
179+
180+
[plugins."io.containerd.internal.v1.opt"]
181+
path = "/opt/containerd"
182+
183+
[plugins."io.containerd.internal.v1.restart"]
184+
interval = "10s"
185+
186+
# Removed in latest
187+
#[plugins."io.containerd.internal.v1.tracing"]
188+
# sampling_ratio = 1.0
189+
# service_name = "containerd"
190+
191+
[plugins."io.containerd.metadata.v1.bolt"]
192+
content_sharing_policy = "shared"
193+
194+
[plugins."io.containerd.monitor.v1.cgroups"]
195+
no_prometheus = false
196+
197+
[plugins."io.containerd.nri.v1.nri"]
198+
# Updated in latest
199+
#disable = true
200+
disable = false
201+
disable_connections = false
202+
plugin_config_path = "/etc/nri/conf.d"
203+
plugin_path = "/opt/nri/plugins"
204+
plugin_registration_timeout = "5s"
205+
plugin_request_timeout = "2s"
206+
socket_path = "/var/run/nri/nri.sock"
207+
208+
# Removed in latest
209+
#[plugins."io.containerd.runtime.v1.linux"]
210+
# no_shim = false
211+
# runtime = "runc"
212+
# runtime_root = ""
213+
# shim = "containerd-shim"
214+
# shim_debug = false
215+
216+
[plugins."io.containerd.runtime.v2.task"]
217+
platforms = ["linux/amd64"]
218+
sched_core = false
219+
220+
[plugins."io.containerd.service.v1.diff-service"]
221+
default = ["walking"]
222+
223+
[plugins."io.containerd.service.v1.tasks-service"]
224+
blockio_config_file = ""
225+
rdt_config_file = ""
226+
227+
# Removed in latest
228+
#[plugins."io.containerd.snapshotter.v1.aufs"]
229+
# root_path = ""
230+
231+
[plugins."io.containerd.snapshotter.v1.blockfile"]
232+
fs_type = ""
233+
mount_options = []
234+
root_path = ""
235+
scratch_file = ""
236+
237+
[plugins."io.containerd.snapshotter.v1.btrfs"]
238+
root_path = ""
239+
240+
[plugins."io.containerd.snapshotter.v1.devmapper"]
241+
async_remove = false
242+
base_image_size = ""
243+
discard_blocks = false
244+
fs_options = ""
245+
fs_type = ""
246+
pool_name = ""
247+
root_path = ""
248+
249+
[plugins."io.containerd.snapshotter.v1.native"]
250+
root_path = ""
251+
252+
[plugins."io.containerd.snapshotter.v1.overlayfs"]
253+
mount_options = []
254+
root_path = ""
255+
sync_remove = false
256+
upperdir_label = false
257+
258+
# Removed in latest
259+
#[plugins."io.containerd.snapshotter.v1.zfs"]
260+
# root_path = ""
261+
262+
# Removed in latest
263+
#[plugins."io.containerd.tracing.processor.v1.otlp"]
264+
# endpoint = ""
265+
# insecure = false
266+
# protocol = ""
267+
268+
[plugins."io.containerd.transfer.v1.local"]
269+
config_path = ""
270+
max_concurrent_downloads = 3
271+
max_concurrent_uploaded_layers = 3
272+
273+
# In 2.0, the default unpack config is applied when not specified
274+
#[[plugins."io.containerd.transfer.v1.local".unpack_config]]
275+
# differ = ""
276+
# platform = "linux/amd64"
277+
# snapshotter = "overlayfs"
278+
279+
[proxy_plugins]
280+
281+
[stream_processors]
282+
283+
[stream_processors."io.containerd.ocicrypt.decoder.v1.tar"]
284+
accepts = ["application/vnd.oci.image.layer.v1.tar+encrypted"]
285+
args = ["--decryption-keys-path", "/etc/containerd/ocicrypt/keys"]
286+
env = ["OCICRYPT_KEYPROVIDER_CONFIG=/etc/containerd/ocicrypt/ocicrypt_keyprovider.conf"]
287+
path = "ctd-decoder"
288+
returns = "application/vnd.oci.image.layer.v1.tar"
289+
290+
[stream_processors."io.containerd.ocicrypt.decoder.v1.tar.gzip"]
291+
accepts = ["application/vnd.oci.image.layer.v1.tar+gzip+encrypted"]
292+
args = ["--decryption-keys-path", "/etc/containerd/ocicrypt/keys"]
293+
env = ["OCICRYPT_KEYPROVIDER_CONFIG=/etc/containerd/ocicrypt/ocicrypt_keyprovider.conf"]
294+
path = "ctd-decoder"
295+
returns = "application/vnd.oci.image.layer.v1.tar+gzip"
296+
297+
[timeouts]
298+
"io.containerd.timeout.bolt.open" = "0s"
299+
"io.containerd.timeout.metrics.shimstats" = "2s"
300+
"io.containerd.timeout.shim.cleanup" = "5s"
301+
"io.containerd.timeout.shim.load" = "5s"
302+
"io.containerd.timeout.shim.shutdown" = "3s"
303+
"io.containerd.timeout.task.state" = "2s"
304+
305+
[ttrpc]
306+
address = ""
307+
gid = 0
308+
uid = 0

0 commit comments

Comments
 (0)