mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-18 17:33:02 +00:00
kata-deploy: Simplify shim configuration
We never have to add a configuration for the "default" case, as we're already creating the runtime class pointing to what should be the "default" handler. This helps to simplify the logic by quite a lot. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
e618949937
commit
7ad873cf29
@ -294,14 +294,11 @@ function cleanup_different_shims_base() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function configure_crio_runtime() {
|
function configure_crio_runtime() {
|
||||||
local runtime="kata"
|
local shim="${1}"
|
||||||
local configuration="configuration"
|
local runtime="kata-${shim}"
|
||||||
if [ -n "${1-}" ]; then
|
local configuration="configuration-${shim}"
|
||||||
runtime+="-$1"
|
|
||||||
configuration+="-$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local config_path=$(get_kata_containers_config_path "${1}")
|
local config_path=$(get_kata_containers_config_path "${shim}")
|
||||||
|
|
||||||
local kata_path="/usr/local/bin/containerd-shim-${runtime}-v2"
|
local kata_path="/usr/local/bin/containerd-shim-${runtime}-v2"
|
||||||
local kata_conf="crio.runtime.runtimes.${runtime}"
|
local kata_conf="crio.runtime.runtimes.${runtime}"
|
||||||
@ -343,12 +340,9 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
function configure_containerd_runtime() {
|
function configure_containerd_runtime() {
|
||||||
local runtime="kata"
|
local shim="$2"
|
||||||
local configuration="configuration"
|
local runtime="kata-${shim}"
|
||||||
if [ -n "${2-}" ]; then
|
local configuration="configuration-${shim}"
|
||||||
runtime+="-$2"
|
|
||||||
configuration+="-$2"
|
|
||||||
fi
|
|
||||||
local pluginid=cri
|
local pluginid=cri
|
||||||
|
|
||||||
# if we are running k0s auto containerd.toml generation, the base template is by default version 2
|
# if we are running k0s auto containerd.toml generation, the base template is by default version 2
|
||||||
@ -359,7 +353,7 @@ function configure_containerd_runtime() {
|
|||||||
local runtime_table=".plugins.${pluginid}.containerd.runtimes.\"${runtime}\""
|
local runtime_table=".plugins.${pluginid}.containerd.runtimes.\"${runtime}\""
|
||||||
local runtime_options_table="${runtime_table}.options"
|
local runtime_options_table="${runtime_table}.options"
|
||||||
local runtime_type=\"io.containerd."${runtime}".v2\"
|
local runtime_type=\"io.containerd."${runtime}".v2\"
|
||||||
local runtime_config_path=\"$(get_kata_containers_config_path "${2-}")/${configuration}.toml\"
|
local runtime_config_path=\"$(get_kata_containers_config_path "${shim}")/${configuration}.toml\"
|
||||||
|
|
||||||
tomlq -i -t $(printf '%s.runtime_type=%s' ${runtime_table} ${runtime_type}) ${containerd_conf_file}
|
tomlq -i -t $(printf '%s.runtime_type=%s' ${runtime_table} ${runtime_type}) ${containerd_conf_file}
|
||||||
tomlq -i -t $(printf '%s.privileged_without_host_devices=true' ${runtime_table}) ${containerd_conf_file}
|
tomlq -i -t $(printf '%s.privileged_without_host_devices=true' ${runtime_table}) ${containerd_conf_file}
|
||||||
@ -382,9 +376,6 @@ function configure_containerd() {
|
|||||||
cp -n "$containerd_conf_file" "$containerd_conf_file_backup"
|
cp -n "$containerd_conf_file" "$containerd_conf_file_backup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add default Kata runtime configuration
|
|
||||||
configure_containerd_runtime "$1"
|
|
||||||
|
|
||||||
for shim in "${shims[@]}"; do
|
for shim in "${shims[@]}"; do
|
||||||
configure_containerd_runtime "$1" $shim
|
configure_containerd_runtime "$1" $shim
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user