Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
ci: Modify Firecracker to install from repository
Browse files Browse the repository at this point in the history
Instead of installing firecracker, runtime, and all the other Kata
components from the tar, this will change to install from the sources.

Fixes #1091

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
  • Loading branch information
GabyCT committed Jan 24, 2019
1 parent 1f454bd commit 0c121a4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 30 deletions.
37 changes: 18 additions & 19 deletions .ci/install_firecracker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -o pipefail
cidir=$(dirname "$0")
arch=$("${cidir}"/kata-arch.sh -d)
source "${cidir}/lib.sh"
KATA_DEV_MODE="${KATA_DEV_MODE:-false}"

if [ "$arch" != "x86_64" ]; then
die "Static binaries for Firecracker only available with x86_64."
Expand All @@ -26,17 +27,23 @@ if [ "$docker_version" != "18.06" ]; then
die "Firecracker hypervisor only works with docker 18.06"
fi

# This is the initial release of Kata
# Containers that introduces support for
# the Firecracker hypervisor
release_version="1.5.0-rc2"
file_name="kata-fc-static-${release_version}-${arch}.tar.gz"
url="https://github.com/kata-containers/runtime/releases/download/${release_version}/${file_name}"
echo "Get static binaries from release version ${release_version}"
curl -OL ${url}
# Get url for firecracker from runtime/versions.yaml
firecracker_repo=$(get_version "assets.hypervisor.firecracker.url")
[ -n "$firecracker_repo" ] || die "failed to get firecracker repo"
firecracker_repo=${firecracker_repo/https:\/\//}

echo "Decompress binaries from release version ${release_version}"
sudo tar -xvf ${file_name} -C /
# Get version for firecracker from runtime/versions.yaml
firecracker_version=$(get_version "assets.hypervisor.firecracker.version")
[ -n "$firecracker_version" ] || die "failed to get firecracker version"

# Get firecracker
go get -d ${firecracker_repo} || true
# Checkout to specific version
pushd "${GOPATH}/src/${firecracker_repo}"
git checkout tags/${firecracker_version}
./tools/devtool --unattended build --release -- --features vsock
sudo mv ${GOPATH}/src/${firecracker_repo}/build/release/firecracker /usr/bin/
popd

echo "Install and configure docker"
docker_configuration_path="/etc/docker"
Expand All @@ -51,10 +58,7 @@ docker_configuration_file=$docker_configuration_path/daemon.json
# is required
driver="devicemapper"

# From decompressing the tarball, all the files are placed within
# /opt/kata. The runtime configuration is expected to land at
# /opt/kata/share/defaults/kata-containers/configuration.toml
path="/opt/kata/bin/kata-runtime"
path="/usr/local/bin/kata-runtime"

if [ -f $docker_configuration_file ]; then
# Check devicemapper flag
Expand Down Expand Up @@ -85,8 +89,3 @@ check_vsock=$(sudo modprobe vhost_vsock)
if [ $? != 0 ]; then
die "vsock is not supported on your host system"
fi

# FIXME - we need to create a symbolic link for kata-runtime
# in order that kata-runtime kata-env works
# https://github.com/kata-containers/runtime/issues/1144
sudo ln -s /opt/kata/bin/kata-runtime /usr/local/bin/
10 changes: 8 additions & 2 deletions .ci/install_kata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ set -o pipefail
cidir=$(dirname "$0")
source /etc/os-release || source /usr/lib/os-release
source "${cidir}/lib.sh"
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

echo "Install kata-containers image"
"${cidir}/install_kata_image.sh"

echo "Install Kata Containers Kernel"
"${cidir}/install_kata_kernel.sh"

echo "Install Qemu"
"${cidir}/install_qemu.sh"
if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
echo "Install Firecracker"
"${cidir}/install_firecracker.sh"
else
echo "Install Qemu"
"${cidir}/install_qemu.sh"
fi

echo "Install shim"
"${cidir}/install_shim.sh"
Expand Down
13 changes: 9 additions & 4 deletions .ci/install_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cidir=$(dirname "$0")

source "${cidir}/lib.sh"
source /etc/os-release || source /usr/lib/os-release
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

# Modify the runtimes build-time defaults

Expand Down Expand Up @@ -77,7 +78,11 @@ if [ "$USE_VSOCK" == "yes" ]; then
fi
fi

echo "Add runtime as a new/default Docker runtime. Docker version \"$(docker --version)\" could change according to updates."
docker_options="-D --add-runtime kata-runtime=/usr/local/bin/kata-runtime"
echo "Add kata-runtime as a new/default Docker runtime."
"${cidir}/../cmd/container-manager/manage_ctr_mgr.sh" docker configure -r kata-runtime -f
if [ "$KATA_HYPERVISOR" == "qemu" ]; then
echo "Add runtime as a new/default Docker runtime. Docker version \"$(docker --version)\" could change according to updates."
docker_options="-D --add-runtime kata-runtime=/usr/local/bin/kata-runtime"
echo "Add kata-runtime as a new/default Docker runtime."
"${cidir}/../cmd/container-manager/manage_ctr_mgr.sh" docker configure -r kata-runtime -f
else
echo "Kata runtime will not set as a default in Docker"
fi
15 changes: 10 additions & 5 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ install_kata() {
fi
}

install_firecracker() {
echo "Install Firecracker"
bash -f ${cidir}/install_firecracker.sh
}

install_extra_tools() {
echo "Install CNI plugins"
bash -f "${cidir}/install_cni_plugins.sh"
Expand Down Expand Up @@ -121,6 +116,13 @@ install_extra_tools() {
echo "Openshift not installed"
}

modify_firecracker_configuration_toml() {
runtime_path="/usr/share/defaults/kata-containers"
echo "Enable firecracker configuration.toml"
mv ${runtime_path}/configuration-fc.toml ${runtime_path}/configuration.toml
sudo systemctl daemon-reload
}

main() {
check_gopath
setup_distro_env
Expand All @@ -132,6 +134,9 @@ main() {
install_kata
fi
install_extra_tools
if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
modify_firecracker_configuration_toml
fi
echo "Disable systemd-journald rate limit"
sudo crudini --set /etc/systemd/journald.conf Journal RateLimitInterval 0s
sudo crudini --set /etc/systemd/journald.conf Journal RateLimitBurst 0
Expand Down

0 comments on commit 0c121a4

Please sign in to comment.