mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 04:34:27 +00:00
kata-deploy: Give users the ability to run it on DEBUG mode
The DEBUG env var introduced to the kata-deploy / kata-cleanup yaml file will be responsible for: * Setting up the CRI Engine to run with the debug log level set to debug * The default is usually info * Setting up Kata Containers to enable: * debug logs * debug console * agent logs This will help a lot folks trying to debug Kata Containers while using kata-deploy, and also help us to always run with DEBUG=yes as part of our CI. Fixes: #7342 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
9b3dc572ae
commit
8f4b1df9cf
@ -26,6 +26,8 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
|
- name: DEBUG
|
||||||
|
value: "no"
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
@ -28,6 +28,8 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: spec.nodeName
|
fieldPath: spec.nodeName
|
||||||
|
- name: DEBUG
|
||||||
|
value: "no"
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
@ -10,6 +10,7 @@ set -o nounset
|
|||||||
|
|
||||||
crio_drop_in_conf_dir="/etc/crio/crio.conf.d/"
|
crio_drop_in_conf_dir="/etc/crio/crio.conf.d/"
|
||||||
crio_drop_in_conf_file="${crio_drop_in_conf_dir}/99-kata-deploy"
|
crio_drop_in_conf_file="${crio_drop_in_conf_dir}/99-kata-deploy"
|
||||||
|
crio_drop_in_conf_file_debug="${crio_drop_in_conf_dir}/100-debug"
|
||||||
containerd_conf_file="/etc/containerd/config.toml"
|
containerd_conf_file="/etc/containerd/config.toml"
|
||||||
containerd_conf_file_backup="${containerd_conf_file}.bak"
|
containerd_conf_file_backup="${containerd_conf_file}.bak"
|
||||||
|
|
||||||
@ -65,6 +66,16 @@ function install_artifacts() {
|
|||||||
[ -d /opt/kata/runtime-rs/bin ] && \
|
[ -d /opt/kata/runtime-rs/bin ] && \
|
||||||
chmod +x /opt/kata/runtime-rs/bin/*
|
chmod +x /opt/kata/runtime-rs/bin/*
|
||||||
|
|
||||||
|
# Allow enabling debug for Kata Containers
|
||||||
|
if [[ "${DEBUG:-"no"}" == "yes" ]]; then
|
||||||
|
config_path="/opt/kata/share/defaults/kata-containers/"
|
||||||
|
for shim in "${shims[@]}"; do
|
||||||
|
sed -i -e 's/^#\(enable_debug\).*=.*$/\1 = true/g' "${config_path}/configuration-${shim}.toml"
|
||||||
|
sed -i -e 's/^#\(debug_console_enabled\).*=.*$/\1 = true/g' "${config_path}/configuration-${shim}.toml"
|
||||||
|
sed -i -e 's/^kernel_params = "\(.*\)"/kernel_params = "\1 agent.log=debug initcall_debug"/g' "${config_path}/configuration-${shim}.toml"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Allow Mariner to use custom configuration.
|
# Allow Mariner to use custom configuration.
|
||||||
if [ "${HOST_OS:-}" == "cbl-mariner" ]; then
|
if [ "${HOST_OS:-}" == "cbl-mariner" ]; then
|
||||||
config_path="/opt/kata/share/defaults/kata-containers/configuration-clh.toml"
|
config_path="/opt/kata/share/defaults/kata-containers/configuration-clh.toml"
|
||||||
@ -212,6 +223,14 @@ function configure_crio() {
|
|||||||
for shim in "${shims[@]}"; do
|
for shim in "${shims[@]}"; do
|
||||||
configure_crio_runtime $shim
|
configure_crio_runtime $shim
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${DEBUG:-"no"}" == "yes" ]; then
|
||||||
|
cat <<EOF | tee -a $crio_drop_in_conf_file_debug
|
||||||
|
[crio]
|
||||||
|
log_level = "debug"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_containerd_runtime() {
|
function configure_containerd_runtime() {
|
||||||
@ -250,6 +269,18 @@ EOF
|
|||||||
ConfigPath = "${config_path}"
|
ConfigPath = "${config_path}"
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${DEBUG:-"no"}" == "yes" ]; then
|
||||||
|
if grep -q "\[debug\]" $containerd_conf_file; then
|
||||||
|
sed -i 's/level.*/level = \"debug\"/' $containerd_conf_file
|
||||||
|
else
|
||||||
|
cat <<EOF | tee -a "$containerd_conf_file"
|
||||||
|
[debug]
|
||||||
|
level = "debug"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_containerd() {
|
function configure_containerd() {
|
||||||
@ -292,6 +323,9 @@ function cleanup_cri_runtime() {
|
|||||||
|
|
||||||
function cleanup_crio() {
|
function cleanup_crio() {
|
||||||
rm $crio_drop_in_conf_file
|
rm $crio_drop_in_conf_file
|
||||||
|
if [[ "${DEBUG:-"no"}" == "yes" ]]; then
|
||||||
|
rm $crio_drop_in_conf_file_debug
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_containerd() {
|
function cleanup_containerd() {
|
||||||
|
Loading…
Reference in New Issue
Block a user