Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-builder: introduce SHIM_REDEPLOY_CONFIG #226

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tools/osbuilder/node-builder/azure-linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#
BUILD_TYPE := release

export SHIM_REDEPLOY_CONFIG := yes

ifeq ($(BUILD_TYPE),debug)
export AGENT_BUILD_TYPE := debug
export AGENT_POLICY_FILE := allow-all.rego
Expand Down
22 changes: 22 additions & 0 deletions tools/osbuilder/node-builder/azure-linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Notes:

## Debug build

This section describes how to build and deploy in debug mode.

`make all-confpods` takes the following variables:

* `AGENT_BUILD_TYPE`: Specify `release` (default) to build the agent in
Expand Down Expand Up @@ -179,6 +181,26 @@ config with `BUILD_TYPE=debug`:
sudo make BUILD_TYPE=debug SHIM_USE_DEBUG_CONFIG=no all-confpods deploy-confpods
```

### Prevent redeploying the shim configuration

If you're manually modifying the shim configuration directly on the host
during development and you don't want to redeploy and overwrite that
file each time you redeploy binaries, you can separately specify the
`SHIM_REDEPLOY_CONFIG` (default `yes`):

```shell
sudo make SHIM_REDEPLOY_CONFIG=no all-confpods deploy-confpods
```

Note that this variable is independent from the other variables
mentioned above. So if you want to avoid redeploying the shim
configuration AND build in debug mode, you have to use the following
command:

```shell
sudo make BUILD_TYPE=debug SHIM_REDEPLOY_CONFIG=no all-confpods deploy-confpods
```

# Run Kata (Confidential) Containers

## Run via CRI or via containerd API
Expand Down
18 changes: 14 additions & 4 deletions tools/osbuilder/node-builder/azure-linux/package_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -o errtrace

CONF_PODS=${CONF_PODS:-no}
PREFIX=${PREFIX:-}
SHIM_REDEPLOY_CONFIG=${SHIM_REDEPLOY_CONFIG:-yes}
SHIM_USE_DEBUG_CONFIG=${SHIM_USE_DEBUG_CONFIG:-no}
START_SERVICES=${START_SERVICES:-yes}

Expand All @@ -38,8 +39,12 @@ if [ "${CONF_PODS}" == "yes" ]; then
mkdir -p ${PREFIX}/usr/lib/systemd/system/
cp -a --backup=numbered src/tardev-snapshotter/tardev-snapshotter.service ${PREFIX}/usr/lib/systemd/system/

echo "Installing SNP shim debug configuration"
cp -a --backup=numbered src/runtime/config/"${SHIM_DBG_CONFIG_FILE_NAME}" "${PREFIX}/${SHIM_CONFIG_PATH}"/"${SHIM_DBG_CONFIG_INST_FILE_NAME}"
if [ "${SHIM_REDEPLOY_CONFIG}" == "yes" ]; then
echo "Installing SNP shim debug configuration"
cp -a --backup=numbered src/runtime/config/"${SHIM_DBG_CONFIG_FILE_NAME}" "${PREFIX}/${SHIM_CONFIG_PATH}"/"${SHIM_DBG_CONFIG_INST_FILE_NAME}"
else
echo "Skipping installation of SNP shim debug configuration"
fi

if [ "${SHIM_USE_DEBUG_CONFIG}" == "yes" ]; then
# We simply override the release config with the debug config,
Expand All @@ -59,9 +64,14 @@ cp -a --backup=numbered src/runtime/kata-runtime "${PREFIX}/${DEBUGGING_BINARIES
chmod +x src/runtime/data/kata-collect-data.sh
cp -a --backup=numbered src/runtime/data/kata-collect-data.sh "${PREFIX}/${DEBUGGING_BINARIES_PATH}"

echo "Installing shim binary and configuration"
echo "Installing shim binary"
cp -a --backup=numbered src/runtime/containerd-shim-kata-v2 "${PREFIX}/${SHIM_BINARIES_PATH}"/"${SHIM_BINARY_NAME}"

cp -a --backup=numbered src/runtime/config/"${SHIM_CONFIG_FILE_NAME}" "${PREFIX}/${SHIM_CONFIG_PATH}/${SHIM_CONFIG_INST_FILE_NAME}"
if [ "${SHIM_REDEPLOY_CONFIG}" == "yes" ]; then
echo "Installing shim configuration"
cp -a --backup=numbered src/runtime/config/"${SHIM_CONFIG_FILE_NAME}" "${PREFIX}/${SHIM_CONFIG_PATH}/${SHIM_CONFIG_INST_FILE_NAME}"
else
echo "Skipping installation of shim configuration"
fi

popd
Loading