kata-deploy: QEMU, for 2.x, already includes virtiofs

There's no reason to ship qemu & qemu-virtiofs when the former already
includes vitiofs support (and that's the default for 2.x deployments).

In case we will enable experimental qemu DAX support, we should add a
new target, a "qemu-experimental" target, as Carlos has been working on.

Fixes: #1424

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio
2021-02-18 11:59:15 +01:00
parent 657bd789a3
commit f21c54a985
15 changed files with 7 additions and 334 deletions

View File

@@ -17,7 +17,6 @@ supported_artifacts=(
"install_kata_components"
"install_kernel"
"install_qemu"
"install_qemu_virtiofsd"
)
for c in ${supported_artifacts[@]}; do echo $c; done

View File

@@ -133,7 +133,7 @@ This image contains all the necessary artifacts for running Kata Containers, all
from the [Kata Containers release page](https://github.com/kata-containers/runtime/releases).
Host artifacts:
* `cloud-hypervisor`, `firecracker`, `qemu-system-x86_64`, `qemu-virtiofs-system-x86_64` and supporting binaries
* `cloud-hypervisor`, `firecracker`, `qemu-system-x86_64`, and supporting binaries
* `containerd-shim-kata-v2`
* `kata-collect-data.sh`
* `kata-runtime`

View File

@@ -116,7 +116,6 @@ function test_kata() {
# apply runtime classes:
kubectl apply -f "$YAMLPATH/k8s-1.14/kata-clh-runtimeClass.yaml"
kubectl apply -f "$YAMLPATH/k8s-1.14/kata-qemu-runtimeClass.yaml"
kubectl apply -f "$YAMLPATH/k8s-1.14/kata-qemu-virtiofs-runtimeClass.yaml"
kubectl get runtimeclasses

View File

@@ -1,42 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: php-apache-kata-qemu-virtiofs
name: php-apache-kata-qemu-virtiofs
spec:
replicas: 1
selector:
matchLabels:
run: php-apache-kata-qemu-virtiofs
template:
metadata:
labels:
run: php-apache-kata-qemu-virtiofs
spec:
runtimeClassName: kata-qemu-virtiofs
containers:
- image: k8s.gcr.io/hpa-example
imagePullPolicy: Always
name: php-apache
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: 200m
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: php-apache-kata-qemu-virtiofs
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: php-apache-kata-qemu-virtiofs
sessionAffinity: None
type: ClusterIP

View File

@@ -1,14 +0,0 @@
---
kind: RuntimeClass
apiVersion: node.k8s.io/v1alpha1
metadata:
name: kata-qemu-virtiofs
spec:
runtimeHandler: kata-qemu-virtiofs
---
kind: RuntimeClass
apiVersion: node.k8s.io/v1alpha1
metadata:
name: kata
spec:
runtimeHandler: kata

View File

@@ -1,12 +0,0 @@
---
kind: RuntimeClass
apiVersion: node.k8s.io/v1beta1
metadata:
name: kata
handler: kata
---
kind: RuntimeClass
apiVersion: node.k8s.io/v1beta1
metadata:
name: kata-qemu-virtiofs
handler: kata-qemu-virtiofs

View File

@@ -147,13 +147,6 @@ install_qemu() {
kata_version="${kata_version}" "${pkg_root_dir}/static-build/qemu/build-static-qemu.sh"
}
# Install static qemu-virtiofsd asset
install_qemu_virtiofsd() {
kata_version=${1:-$kata_version}
info "build static qemu-virtiofs"
kata_version="${kata_version}" "${pkg_root_dir}/static-build/qemu-virtiofs/build-static-qemu-virtiofs.sh"
}
# Install static firecracker asset
install_firecracker() {
kata_version=${1:-$kata_version}
@@ -211,8 +204,6 @@ install_kata_components() {
untar_qemu_binaries() {
info "Install static qemu"
tar xf kata-static-qemu.tar.gz -C "${destdir}"
info "Install static qemu-virtiofs"
tar xf kata-static-qemu-virtiofsd.tar.gz -C "${destdir}"
}
main() {
@@ -242,7 +233,6 @@ main() {
install_kernel
install_clh
install_qemu
install_qemu_virtiofsd
install_firecracker
install_image

View File

@@ -1,78 +0,0 @@
# Copyright (c) 2019 Intel Corporation
# Copyright (c) 2020 Ant Group
#
# SPDX-License-Identifier: Apache-2.0
from ubuntu:20.04
ARG QEMU_DESTDIR
ARG QEMU_VIRTIOFS_REPO
# commit/tag/branch
ARG QEMU_VIRTIOFS_TAG
ARG QEMU_TARBALL
ARG PREFIX
WORKDIR /root/qemu-virtiofs
RUN apt-get update && apt-get upgrade -y
RUN apt-get --no-install-recommends install -y \
apt-utils \
autoconf \
automake \
bc \
bison \
ca-certificates \
cpio \
flex \
gawk \
libaudit-dev \
libblkid-dev \
libcap-dev \
libcap-ng-dev \
libdw-dev \
libelf-dev \
libffi-dev \
libglib2.0-0 \
libglib2.0-dev \
libglib2.0-dev git \
libltdl-dev \
libmount-dev \
libpixman-1-dev \
libpmem-dev \
libseccomp-dev \
libseccomp2 \
libselinux1-dev \
libtool \
make \
pkg-config \
pkg-config \
python \
python-dev \
rsync \
seccomp \
zlib1g-dev
RUN cd .. && git clone "${QEMU_VIRTIOFS_REPO}" qemu-virtiofs
RUN git checkout "${QEMU_VIRTIOFS_TAG}"
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
ADD qemu /root/kata_qemu
ADD scripts/apply_patches.sh /root/apply_patches.sh
ADD static-build /root/static-build
# Apply experimental specific patches
# Patches to quick fix virtiofs fork
ENV VIRTIOFS_PATCHES_DIR=/root/kata_qemu/patches/${QEMU_VIRTIOFS_TAG}/
RUN /root/apply_patches.sh ${VIRTIOFS_PATCHES_DIR}
# Apply the stable branch patches
RUN stable_branch=$(cat VERSION | awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}') && \
/root/apply_patches.sh "/root/kata_qemu/patches/${stable_branch}"
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-qemu | sed -e 's|--disable-seccomp||g' | xargs ./configure \
--with-pkgversion=kata-static
RUN make -j$(nproc)
RUN make -j$(nproc) virtiofsd
RUN make install DESTDIR="${QEMU_DESTDIR}"
RUN cd "${QEMU_DESTDIR}/${PREFIX}" && \
mv bin/qemu-system-x86_64 bin/qemu-virtiofs-system-x86_64 && \
mv libexec/kata-qemu/virtiofsd bin/virtiofsd-dax
RUN /root/static-build/scripts/qemu-build-post.sh

View File

@@ -1,7 +0,0 @@
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CONFIG_DIR := $(MK_DIR)/../../scripts/
build:
"$(MK_DIR)/build-static-qemu-virtiofs.sh"
clean:
rm -f kata-qemu-static.tar.gz

View File

@@ -1,56 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${script_dir}/../../scripts/lib.sh"
source "${script_dir}/../qemu.blacklist"
DOCKER_CLI="docker"
if ! command -v docker &>/dev/null && command -v podman &>/dev/null; then
DOCKER_CLI="podman"
fi
kata_version="${kata_version:-}"
packaging_dir="${script_dir}/../.."
qemu_virtiofs_repo=$(get_from_kata_deps "assets.hypervisor.qemu-experimental.url" "${kata_version}")
# This tag will be supported on the runtime versions.yaml
qemu_virtiofs_tag=$(get_from_kata_deps "assets.hypervisor.qemu-experimental.tag" "${kata_version}")
qemu_virtiofs_tar="kata-static-qemu-virtiofsd.tar.gz"
qemu_tmp_tar="kata-static-qemu-virtiofsd-tmp.tar.gz"
qemu_destdir="/tmp/qemu-virtiofs-static"
info "Build ${qemu_virtiofs_repo} tag: ${qemu_virtiofs_tag}"
http_proxy="${http_proxy:-}"
https_proxy="${https_proxy:-}"
prefix="${prefix:-"/opt/kata"}"
sudo "${DOCKER_CLI}" build \
--no-cache \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
--build-arg QEMU_DESTDIR="${qemu_destdir}" \
--build-arg QEMU_VIRTIOFS_REPO="${qemu_virtiofs_repo}" \
--build-arg QEMU_VIRTIOFS_TAG="${qemu_virtiofs_tag}" \
--build-arg QEMU_TARBALL="${qemu_virtiofs_tar}" \
--build-arg PREFIX="${prefix}" \
"${packaging_dir}" \
-f "${script_dir}/Dockerfile" \
-t qemu-virtiofs-static
sudo "${DOCKER_CLI}" run \
--rm \
-i \
-v "${PWD}":/share qemu-virtiofs-static \
mv "${qemu_destdir}/${qemu_virtiofs_tar}" /share/
sudo chown ${USER}:${USER} "${PWD}/${qemu_virtiofs_tar}"