mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 02:14:29 +00:00
Merge pull request #1782 from fidencio/wip/kata-deploy-update-crio-config
Update kata-deploy to use CRI-O drop-in files
This commit is contained in:
@@ -8,8 +8,8 @@ set -o errexit
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
crio_conf_file="/etc/crio/crio.conf"
|
crio_drop_in_conf_dir="/etc/crio/crio.conf.d/"
|
||||||
crio_conf_file_backup="${crio_conf_file}.bak"
|
crio_drop_in_conf_file="${crio_drop_in_conf_dir}/99-kata-deploy"
|
||||||
containerd_conf_file="/etc/containerd/config.toml"
|
containerd_conf_file="/etc/containerd/config.toml"
|
||||||
containerd_conf_file_backup="${containerd_conf_file}.bak"
|
containerd_conf_file_backup="${containerd_conf_file}.bak"
|
||||||
|
|
||||||
@@ -123,12 +123,7 @@ function configure_crio_runtime() {
|
|||||||
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}"
|
||||||
|
|
||||||
if grep -qEe "^\[$kata_conf\]" $crio_conf_file; then
|
cat <<EOT | tee -a "$crio_drop_in_conf_file"
|
||||||
echo "Configuration exists $kata_conf, overwriting"
|
|
||||||
sed -i "/\[$kata_conf\]/\[$kata_conf-original\]/" $crio_conf_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOT | tee -a "$crio_conf_file"
|
|
||||||
|
|
||||||
# Path to the Kata Containers runtime binary that uses the $1
|
# Path to the Kata Containers runtime binary that uses the $1
|
||||||
[$kata_conf]
|
[$kata_conf]
|
||||||
@@ -143,17 +138,16 @@ function configure_crio() {
|
|||||||
# Configure crio to use Kata:
|
# Configure crio to use Kata:
|
||||||
echo "Add Kata Containers as a supported runtime for CRIO:"
|
echo "Add Kata Containers as a supported runtime for CRIO:"
|
||||||
|
|
||||||
# backup the CRIO.conf only if a backup doesn't already exist (don't override original)
|
# As we don't touch the original configuration file in any way,
|
||||||
cp -n "$crio_conf_file" "$crio_conf_file_backup"
|
# let's just ensure we remove any exist configuration from a
|
||||||
|
# previous deployment.
|
||||||
|
mkdir -p "$crio_drop_in_conf_dir"
|
||||||
|
rm -f "$crio_drop_in_conf_file"
|
||||||
|
touch "$crio_drop_in_conf_file"
|
||||||
|
|
||||||
for shim in "${shims[@]}"; do
|
for shim in "${shims[@]}"; do
|
||||||
configure_crio_runtime $shim
|
configure_crio_runtime $shim
|
||||||
done
|
done
|
||||||
|
|
||||||
# Replace if exists, insert otherwise
|
|
||||||
grep -Fq 'manage_network_ns_lifecycle =' $crio_conf_file \
|
|
||||||
&& sed -i '/manage_network_ns_lifecycle =/c manage_network_ns_lifecycle = true' $crio_conf_file \
|
|
||||||
|| sed -i '/\[crio.runtime\]/a manage_network_ns_lifecycle = true' $crio_conf_file
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_containerd_runtime() {
|
function configure_containerd_runtime() {
|
||||||
@@ -233,9 +227,7 @@ function cleanup_cri_runtime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_crio() {
|
function cleanup_crio() {
|
||||||
if [ -f "$crio_conf_file_backup" ]; then
|
rm $crio_drop_in_conf_file
|
||||||
cp "$crio_conf_file_backup" "$crio_conf_file"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_containerd() {
|
function cleanup_containerd() {
|
||||||
|
Reference in New Issue
Block a user