Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #386 from amshinde/check-crio-runtime-config
Browse files Browse the repository at this point in the history
kata-deploy: Add runtime config for crio if it does not exist
  • Loading branch information
jodh-intel authored Mar 15, 2019
2 parents a8c6d94 + 8342ca1 commit e84c62c
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions kata-deploy/scripts/kata-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,30 @@ function configure_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"

cat <<EOT | tee -a "$crio_conf_file"
[crio.runtime.runtimes.kata-qemu]
runtime_path = "/opt/kata/bin/kata-qemu"
local kata_qemu_path="/opt/kata/bin/kata-qemu"
local kata_fc_path="/opt/kata/bin/kata-fc"
local kata_qemu_conf="crio.runtime.runtimes.kata-qemu"
local kata_fc_conf="crio.runtime.runtimes.kata-fc"

if grep -q "^\[$kata_qemu_conf\]" $crio_conf_file; then
echo "Configuration exists $kata_qemu_conf, overwriting"
sed -i "/^\[$kata_qemu_conf\]/,+1s#runtime_path.*#runtime_path = \"${kata_qemu_path}\"#" $crio_conf_file
else
cat <<EOT | tee -a "$crio_conf_file"
[$kata_qemu_conf]
runtime_path = "${kata_qemu_path}"
EOT
fi

[crio.runtime.runtimes.kata-fc]
runtime_path = "/opt/kata/bin/kata-fc"
if grep -q "^\[$kata_fc_conf\]" $crio_conf_file; then
echo "Configuration exists for $kata_fc_conf, overwriting"
sed -i "/^\[$kata_fc_conf\]/,+1s#runtime_path.*#runtime_path = \"${kata_fc_path}\"#" $crio_conf_file
else
cat <<EOT | tee -a "$crio_conf_file"
[$kata_fc_conf]
runtime_path = "${kata_fc_path}"
EOT
fi

# Replace if exists, insert otherwise
grep -Fq 'manage_network_ns_lifecycle =' $crio_conf_file \
Expand Down

0 comments on commit e84c62c

Please sign in to comment.