mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-03 01:44:29 +00:00
Merge pull request #10584 from fidencio/topic/kata-deploy-prepare-for-containerd-config-version-3
kata-deploy: Support containerd configuration version 3
This commit is contained in:
@@ -9,4 +9,4 @@ spec:
|
||||
volumes:
|
||||
- name: containerd-conf
|
||||
hostPath:
|
||||
path: /etc/k0s/containerd.d/
|
||||
path: /etc/k0s/
|
||||
|
@@ -491,12 +491,19 @@ function configure_containerd_runtime() {
|
||||
local configuration="configuration-${shim}"
|
||||
local pluginid=cri
|
||||
|
||||
# if we are running k0s auto containerd.toml generation, the base template is by default version 2
|
||||
# we can safely assume to reference the newer version of cri
|
||||
if grep -q "version = 2\>" $containerd_conf_file || [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then
|
||||
local containerd_root_conf_file="$containerd_conf_file"
|
||||
if [[ "$1" =~ ^(k0s-worker|k0s-controller)$ ]]; then
|
||||
containerd_root_conf_file="/etc/containerd/containerd.toml"
|
||||
fi
|
||||
|
||||
if grep -q "version = 2\>" $containerd_root_conf_file; then
|
||||
pluginid=\"io.containerd.grpc.v1.cri\"
|
||||
fi
|
||||
|
||||
if grep -q "version = 3\>" $containerd_root_conf_file; then
|
||||
pluginid=\"io.containerd.cri.v1.runtime\"
|
||||
fi
|
||||
|
||||
local runtime_table=".plugins.${pluginid}.containerd.runtimes.\"${runtime}\""
|
||||
local runtime_options_table="${runtime_table}.options"
|
||||
local runtime_type=\"io.containerd."${runtime}".v2\"
|
||||
@@ -693,7 +700,8 @@ function main() {
|
||||
# From 1.27.1 onwards k0s enables dynamic configuration on containerd CRI runtimes.
|
||||
# This works by k0s creating a special directory in /etc/k0s/containerd.d/ where user can drop-in partial containerd configuration snippets.
|
||||
# k0s will automatically pick up these files and adds these in containerd configuration imports list.
|
||||
containerd_conf_file="/etc/containerd/kata-containers.toml"
|
||||
containerd_conf_file="/etc/containerd/containerd.d/kata-containers.toml"
|
||||
containerd_conf_file_backup="${containerd_conf_tmpl_file}.bak"
|
||||
fi
|
||||
|
||||
# only install / remove / update if we are dealing with CRIO or containerd
|
||||
@@ -714,6 +722,7 @@ function main() {
|
||||
containerd_conf_file="${containerd_conf_tmpl_file}"
|
||||
containerd_conf_file_backup="${containerd_conf_tmpl_file}.bak"
|
||||
elif [[ "$runtime" =~ ^(k0s-worker|k0s-controller)$ ]]; then
|
||||
mkdir -p $(dirname "$containerd_conf_file")
|
||||
touch "$containerd_conf_file"
|
||||
elif [[ "$runtime" == "containerd" ]]; then
|
||||
if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && [ -x $(command -v containerd) ]; then
|
||||
|
Reference in New Issue
Block a user