mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-20 16:27:52 +00:00
Merge pull request #8709 from fidencio/topic/update-jq-for-kata-deploy
kata-deploy: Update `jq` as part of the kata-deploy daemonset
This commit is contained in:
@@ -23,13 +23,17 @@ RUN \
|
|||||||
ARCH=$(uname -m) && \
|
ARCH=$(uname -m) && \
|
||||||
if [ "${ARCH}" = "x86_64" ]; then ARCH=amd64; fi && \
|
if [ "${ARCH}" = "x86_64" ]; then ARCH=amd64; fi && \
|
||||||
if [ "${ARCH}" = "aarch64" ]; then ARCH=arm64; 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 && \
|
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 && \
|
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} && \
|
mkdir -p ${DESTINATION} && \
|
||||||
tar xvf ${WORKDIR}/${KATA_ARTIFACTS} -C ${DESTINATION} && \
|
tar xvf ${WORKDIR}/${KATA_ARTIFACTS} -C ${DESTINATION} && \
|
||||||
rm -f ${WORKDIR}/${KATA_ARTIFACTS} && \
|
rm -f ${WORKDIR}/${KATA_ARTIFACTS} && \
|
||||||
apk del curl && \
|
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
|
pip install --no-cache-dir yq==3.2.3
|
||||||
|
|
||||||
COPY scripts ${DESTINATION}/scripts
|
COPY scripts ${DESTINATION}/scripts
|
||||||
|
@@ -350,42 +350,18 @@ 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_type="io.containerd.$runtime.v2"
|
local runtime_options_table="${runtime_table}.options"
|
||||||
local options_table="$runtime_table.options"
|
local runtime_type=\"io.containerd."${runtime}".v2\"
|
||||||
local config_path="$(get_kata_containers_config_path "${shim}")/$configuration.toml"
|
local runtime_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 <<EOF | tee -a "$containerd_conf_file"
|
|
||||||
[$runtime_table]
|
|
||||||
runtime_type = "${runtime_type}"
|
|
||||||
privileged_without_host_devices = true
|
|
||||||
pod_annotations = ["io.katacontainers.*"]
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q "\[$options_table\]" $containerd_conf_file; then
|
tomlq -i -t $(printf '%s.runtime_type=%s' ${runtime_table} ${runtime_type}) ${containerd_conf_file}
|
||||||
echo "Configuration exists for $options_table, overwriting"
|
tomlq -i -t $(printf '%s.privileged_without_host_devices=true' ${runtime_table}) ${containerd_conf_file}
|
||||||
sed -i "/\[$options_table\]/,+1s#ConfigPath.*#ConfigPath = \"${config_path}\"#" $containerd_conf_file
|
tomlq -i -t $(printf '%s.pod_annotations=["io.katacontainers.*"]' ${runtime_table}) ${containerd_conf_file}
|
||||||
else
|
tomlq -i -t $(printf '%s.ConfigPath=%s' ${runtime_options_table} ${runtime_config_path}) ${containerd_conf_file}
|
||||||
cat <<EOF | tee -a "$containerd_conf_file"
|
|
||||||
[$options_table]
|
|
||||||
ConfigPath = "${config_path}"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
if grep -q "\[debug\]" $containerd_conf_file; then
|
tomlq -i -t '.debug.level = "debug"' ${containerd_conf_file}
|
||||||
sed -i 's/level.*/level = \"debug\"/' $containerd_conf_file
|
|
||||||
else
|
|
||||||
cat <<EOF | tee -a "$containerd_conf_file"
|
|
||||||
[debug]
|
|
||||||
level = "debug"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user