kata-deploy: Fix k0s deployment

k0s deployment has been broken since we moved to using `tomlq` in our
scripts.  The reason is that before using `tomlq` our script would,
involuntarily, end up creating the file.

Now, in order to fix the situation, we need to explicitly create the
file and let `tomlq` add the needed content.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2024-05-26 19:46:30 +02:00
parent 713c929a64
commit f15d40f8fb
No known key found for this signature in database
GPG Key ID: EE926C2BDACC177B

View File

@ -465,6 +465,7 @@ function configure_containerd_runtime() {
if grep -q "version = 2\>" $containerd_conf_file || [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then if grep -q "version = 2\>" $containerd_conf_file || [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then
pluginid=\"io.containerd.grpc.v1.cri\" pluginid=\"io.containerd.grpc.v1.cri\"
fi fi
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\"
@ -640,6 +641,7 @@ function main() {
# This works by k0s creating a special directory in /etc/k0s/containerd.d/ where user can drop-in partial containerd configuration snippets. # 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. # 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/kata-containers.toml"
touch "$containerd_conf_file"
else else
# runtime == containerd # runtime == containerd
if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && \ if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && \