mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
utils: Improve containerd configuration
`kata-manager.sh` improvements for containerd: - Fixed containerd default branch (which is now `main`). - Only install service file if it doesn't already exist. - Enable the containerd service to ensure it can be started. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
c464f32676
commit
714c9f56fd
@ -391,31 +391,35 @@ configure_containerd()
|
|||||||
|
|
||||||
local cfg="/etc/containerd/config.toml"
|
local cfg="/etc/containerd/config.toml"
|
||||||
|
|
||||||
pushd "$tmpdir" >/dev/null
|
|
||||||
|
|
||||||
local service_url=$(printf "%s/%s/%s/%s" \
|
|
||||||
"https://raw.githubusercontent.com" \
|
|
||||||
"${containerd_slug}" \
|
|
||||||
"master" \
|
|
||||||
"${containerd_service_name}")
|
|
||||||
|
|
||||||
curl -LO "$service_url"
|
|
||||||
|
|
||||||
printf "# %s: Service installed for Kata Containers\n" \
|
|
||||||
"$(date -Iseconds)" |\
|
|
||||||
tee -a "$containerd_service_name"
|
|
||||||
|
|
||||||
local systemd_unit_dir="/etc/systemd/system"
|
local systemd_unit_dir="/etc/systemd/system"
|
||||||
sudo mkdir -p "$systemd_unit_dir"
|
sudo mkdir -p "$systemd_unit_dir"
|
||||||
|
|
||||||
local dest="${systemd_unit_dir}/${containerd_service_name}"
|
local dest="${systemd_unit_dir}/${containerd_service_name}"
|
||||||
|
|
||||||
sudo cp "${containerd_service_name}" "${dest}"
|
if [ ! -f "$dest" ]
|
||||||
sudo systemctl daemon-reload
|
then
|
||||||
|
pushd "$tmpdir" >/dev/null
|
||||||
|
|
||||||
info "Installed ${dest}"
|
local service_url=$(printf "%s/%s/%s/%s" \
|
||||||
|
"https://raw.githubusercontent.com" \
|
||||||
|
"${containerd_slug}" \
|
||||||
|
"main" \
|
||||||
|
"${containerd_service_name}")
|
||||||
|
|
||||||
popd >/dev/null
|
curl -LO "$service_url"
|
||||||
|
|
||||||
|
printf "# %s: Service installed for Kata Containers\n" \
|
||||||
|
"$(date -Iseconds)" |\
|
||||||
|
tee -a "$containerd_service_name"
|
||||||
|
|
||||||
|
|
||||||
|
sudo cp "${containerd_service_name}" "${dest}"
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
|
info "Installed ${dest}"
|
||||||
|
|
||||||
|
popd >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
# Backup the original containerd configuration:
|
# Backup the original containerd configuration:
|
||||||
sudo mkdir -p "$(dirname $cfg)"
|
sudo mkdir -p "$(dirname $cfg)"
|
||||||
@ -448,6 +452,7 @@ EOT
|
|||||||
info "Modified $cfg"
|
info "Modified $cfg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sudo systemctl enable containerd
|
||||||
sudo systemctl start containerd
|
sudo systemctl start containerd
|
||||||
|
|
||||||
info "Configured $project\n"
|
info "Configured $project\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user