mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
kata-deploy: Adapt CRI-O config to use drop-in files
By using drop-in file it simplifies the deployment and maintenance of the CRI-O configurations by a lot, and all versions of CRI-O that should be used together with the currently supported versions of kubenertes support the drop-in configuration file. Depends-on: github.com/kata-containers/kata-containers#1689 Fixes #1781 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
8de2f914ab
commit
2047f26fa3
@ -8,8 +8,8 @@ set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
crio_conf_file="/etc/crio/crio.conf"
|
||||
crio_conf_file_backup="${crio_conf_file}.bak"
|
||||
crio_drop_in_conf_dir="/etc/crio/crio.conf.d/"
|
||||
crio_drop_in_conf_file="${crio_drop_in_conf_dir}/99-kata-deploy"
|
||||
containerd_conf_file="/etc/containerd/config.toml"
|
||||
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_conf="crio.runtime.runtimes.${runtime}"
|
||||
|
||||
if grep -qEe "^\[$kata_conf\]" $crio_conf_file; then
|
||||
echo "Configuration exists $kata_conf, overwriting"
|
||||
sed -i "/\[$kata_conf\]/\[$kata_conf-original\]/" $crio_conf_file
|
||||
fi
|
||||
|
||||
cat <<EOT | tee -a "$crio_conf_file"
|
||||
cat <<EOT | tee -a "$crio_drop_in_conf_file"
|
||||
|
||||
# Path to the Kata Containers runtime binary that uses the $1
|
||||
[$kata_conf]
|
||||
@ -143,8 +138,12 @@ function configure_crio() {
|
||||
# Configure crio to use Kata:
|
||||
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)
|
||||
cp -n "$crio_conf_file" "$crio_conf_file_backup"
|
||||
# As we don't touch the original configuration file in any way,
|
||||
# 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
|
||||
configure_crio_runtime $shim
|
||||
@ -228,9 +227,7 @@ function cleanup_cri_runtime() {
|
||||
}
|
||||
|
||||
function cleanup_crio() {
|
||||
if [ -f "$crio_conf_file_backup" ]; then
|
||||
cp "$crio_conf_file_backup" "$crio_conf_file"
|
||||
fi
|
||||
rm $crio_drop_in_conf_file
|
||||
}
|
||||
|
||||
function cleanup_containerd() {
|
||||
|
Loading…
Reference in New Issue
Block a user