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 <[email protected]>
  • Loading branch information
GabyCT committed Jan 24, 2019
1 parent 1f454bd commit 7044011
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 36 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 install ${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
19 changes: 15 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,17 @@ 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

if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
echo "Enable firecracker configuration.toml"
path="/usr/share/defaults/kata-containers"
sudo mv ${path}/configuration-fc.toml ${path}/configuration.toml
fi
12 changes: 1 addition & 11 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ source "${cidir}/lib.sh"
arch=$("${cidir}"/kata-arch.sh -d)
INSTALL_KATA="${INSTALL_KATA:-yes}"
CI=${CI:-false}
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

# values indicating whether related intergration tests have been supported
CRIO="${CRIO:-yes}"
Expand Down Expand Up @@ -84,11 +83,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 @@ -126,11 +120,7 @@ main() {
setup_distro_env
install_docker
enable_nested_virtualization
if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
install_firecracker
else
install_kata
fi
install_kata
install_extra_tools
echo "Disable systemd-journald rate limit"
sudo crudini --set /etc/systemd/journald.conf Journal RateLimitInterval 0s
Expand Down

0 comments on commit 7044011

Please sign in to comment.