From 41320c586ef80c5d15467dbf31a059be4bab7065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 20 Dec 2023 11:31:19 -0300 Subject: [PATCH 1/2] kata-deploy: Install jq from GitHub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `jq` coming from alpine is in its 1.6 version, and that has a bug that hits us quite hard, as it changes a float to an int whenever the number is in the `x.0` format. One example is: ```bash / # jq --version jq-1.6 / # echo '{"foo": 1.0}' | jq .foo 1 ``` With this in mind, let's switch, at least for now, to using the `jq` released directly on github, as it does address the issue we've been hitting. ```bash ⋊> Downloads ./jq-linux-amd64 --version jq-1.7 ⋊> Downloads echo '{"foo": 1.0}' | jq .foo 1.0 ``` Fixes: #8678 Signed-off-by: Fabiano Fidêncio --- tools/packaging/kata-deploy/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/packaging/kata-deploy/Dockerfile b/tools/packaging/kata-deploy/Dockerfile index 8bcd0f298a..1a30e3b84f 100644 --- a/tools/packaging/kata-deploy/Dockerfile +++ b/tools/packaging/kata-deploy/Dockerfile @@ -23,13 +23,17 @@ RUN \ ARCH=$(uname -m) && \ if [ "${ARCH}" = "x86_64" ]; then ARCH=amd64; fi && \ if [ "${ARCH}" = "aarch64" ]; then ARCH=arm64; fi && \ + DEBIAN_ARCH=${ARCH} && \ + if [ "${DEBIAN_ARCH}" = "ppc64le" ]; then DEBIAN_ARCH=ppc64el; fi && \ curl -fL --progress-bar -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl && \ chmod +x /usr/bin/kubectl && \ + curl -fL --progress-bar -o /usr/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${DEBIAN_ARCH} && \ + chmod +x /usr/bin/jq && \ mkdir -p ${DESTINATION} && \ tar xvf ${WORKDIR}/${KATA_ARTIFACTS} -C ${DESTINATION} && \ rm -f ${WORKDIR}/${KATA_ARTIFACTS} && \ apk del curl && \ - apk --no-cache add jq py3-pip && \ + apk --no-cache add py3-pip && \ pip install --no-cache-dir yq==3.2.3 COPY scripts ${DESTINATION}/scripts From c9e631dc0cc3903ac4945fc98b9ecb6c48855c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 20 Dec 2023 11:34:25 -0300 Subject: [PATCH 2/2] kata-deploy: Reapply "kata-deploy: Use tomlq to configure containerd" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ee5fa08a270467bf78a6382ac6376213b7f44ed8. This is perfectly fine to do as we narrwoed down the issue to be on the version of `jq` provided by alpine, and we've already updated it in the previous commit (in this very same series). Signed-off-by: Fabiano Fidêncio --- .../kata-deploy/scripts/kata-deploy.sh | 54 ++++++------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index 208b3c96ce..7ff1b54d8a 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -94,8 +94,8 @@ function get_container_runtime() { else echo "k3s" fi - # Note: we assumed you used a conventional k0s setup and k0s will generate a systemd entry k0scontroller.service and k0sworker.service respectively - # and it is impossible to run this script without a kubelet, so this k0s controller must also have worker mode enabled + # Note: we assumed you used a conventional k0s setup and k0s will generate a systemd entry k0scontroller.service and k0sworker.service respectively + # and it is impossible to run this script without a kubelet, so this k0s controller must also have worker mode enabled elif host_systemctl is-active --quiet k0scontroller; then echo "k0s-controller" elif host_systemctl is-active --quiet k0sworker; then @@ -344,48 +344,24 @@ function configure_containerd_runtime() { local runtime="kata-${shim}" local configuration="configuration-${shim}" local pluginid=cri - + # if we are running k0s auto containerd.toml generation, the base template is by default version 2 # we can safely assume to reference the newer version of cri if grep -q "version = 2\>" $containerd_conf_file || [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then pluginid=\"io.containerd.grpc.v1.cri\" fi - local runtime_table="plugins.${pluginid}.containerd.runtimes.$runtime" - local runtime_type="io.containerd.$runtime.v2" - local options_table="$runtime_table.options" - local config_path="$(get_kata_containers_config_path "${shim}")/$configuration.toml" - if grep -q "\[$runtime_table\]" $containerd_conf_file; then - echo "Configuration exists for $runtime_table, overwriting" - sed -i "/\[$runtime_table\]/,+1s#runtime_type.*#runtime_type = \"${runtime_type}\"#" $containerd_conf_file - else - cat <