Skip to content

Commit e2b58d9

Browse files
manuelh-devRedent0rchristopherco
authored
kata-containers(-cc): Use build recipes from sources (#10527)
Signed-off-by: Manuel Huber <mahuber@microsoft.com> Co-authored-by: Saul Paredes <30801614+Redent0r@users.noreply.github.com> Co-authored-by: Christopher Co <35273088+christopherco@users.noreply.github.com>
1 parent 3f45590 commit e2b58d9

9 files changed

Lines changed: 175 additions & 496 deletions

File tree

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"Signatures": {
3-
"mariner-coco-build-uvm.sh": "d9780be17493f50936c1e6b6eee789f2843edd5626de9cc8f0a316cc4d70ad5d",
4-
"kata-containers-cc-3.2.0.azl2.tar.gz": "49265e0ecd21af4ed8f23398d1e46ef9961786cb44f40fe582abff06c1c1a873",
5-
"kata-containers-cc-3.2.0.azl2-cargo.tar.gz": "ddf919a672200f0fb53d1cb6c66d6b1c401cf26368541c750d9a12e62da605a1"
3+
"kata-containers-3.2.0.azl3-cargo.tar.gz": "38dd5d2cf22edb75169809978d6578a23d5177590a25dbd97071ff06378ea77d",
4+
"kata-containers-3.2.0.azl3.tar.gz": "078b3b864c7d83a3fddd2b02dc843aba627d97ef1ba2b2ba7dea65efd459e5b1"
65
}
76
}

SPECS/kata-containers-cc/kata-containers-cc.spec

Lines changed: 83 additions & 226 deletions
Large diffs are not rendered by default.

SPECS/kata-containers-cc/mariner-coco-build-uvm.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

SPECS/kata-containers/50-kata

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"Signatures": {
3-
"50-kata": "fb108c6337b3d3bf80b43ab04f2bf9a3bdecd29075ebd16320aefe8f81c502a7",
4-
"mariner-build-uvm.sh": "0777a17a6fab43ccbf167b18e2170d3db2b5727885843468037a9953cad9df0a",
5-
"kata-containers-3.2.0.azl2-cargo.tar.gz": "830c90cc6e44f492e6366012f8834ae6fc84bd790edf678c23003368c288b98c",
6-
"kata-containers-3.2.0.azl2.tar.gz": "ab65f23787347fae11cf07e0a380e925e9f7b6f0f862ef6440a683b816206011"
3+
"kata-containers-3.2.0.azl3-cargo.tar.gz": "38dd5d2cf22edb75169809978d6578a23d5177590a25dbd97071ff06378ea77d",
4+
"kata-containers-3.2.0.azl3.tar.gz": "078b3b864c7d83a3fddd2b02dc843aba627d97ef1ba2b2ba7dea65efd459e5b1"
75
}
86
}

SPECS/kata-containers/kata-containers.spec

Lines changed: 71 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,222 +1,116 @@
1-
%global with_debug 0
2-
# We want verbose builds
3-
%global _configure_disable_silent_rules 1
4-
# Shamelessly copied from CRI-O spec file.
5-
%if 0%{?with_debug}
6-
%global _find_debuginfo_dwz_opts %{nil}
7-
%global _dwz_low_mem_die_limit 0
8-
%else
91
%global debug_package %{nil}
10-
%endif
11-
# https://github.com/rust-lang/rust/issues/47714
12-
%undefine _strict_symbol_defs_build
13-
14-
%global katacache %{_localstatedir}/cache
15-
%global katauvmdir /opt/kata-containers/uvm
16-
%global katalocalstatecachedir %{katacache}/kata-containers
17-
18-
%global kataagentdir %{katauvmdir}/agent
19-
%global kataosbuilderdir %{katauvmdir}/tools/osbuilder
20-
%global kataconfigdir /usr/share/defaults/kata-containers
21-
%global kataclhdir /usr/share/cloud-hypervisor
22-
%global katainitrddir /var/cache/kata-containers/osbuilder-images/kernel-uvm
23-
24-
# DEFAULT_HYPERVISOR: makes configuration.toml link to configuration-clh.toml.
25-
%global runtime_make_vars KERNELTYPE="compressed" \\\
26-
KERNELPARAMS="" \\\
27-
DEFVIRTIOFSDAEMON=%{_libexecdir}/"virtiofsd" \\\
28-
DEFSANDBOXCGROUPONLY=true \\\
29-
DEFSTATICRESOURCEMGMT_CLH=true \\\
30-
DEFSTATICSANDBOXWORKLOADMEM=1792 \\\
31-
DEFMEMSZ=256 \\\
32-
SKIP_GO_VERSION_CHECK=y \\\
33-
DESTDIR=%{buildroot} \\\
34-
PREFIX=/usr \\\
35-
DEFAULT_HYPERVISOR=cloud-hypervisor
36-
37-
%global agent_make_vars LIBC=gnu \\\
38-
DESTDIR=%{buildroot}%{kataagentdir}
39-
40-
Summary: Kata Containers
2+
413
Name: kata-containers
42-
Version: 3.2.0.azl2
43-
Release: 5%{?dist}
4+
Version: 3.2.0.azl3
5+
Release: 1%{?dist}
6+
Summary: Kata Containers package developed for Pod Sandboxing on AKS
447
License: ASL 2.0
458
URL: https://github.com/microsoft/kata-containers
469
Vendor: Microsoft Corporation
4710
Distribution: Azure Linux
4811
Source0: https://github.com/microsoft/kata-containers/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
4912
Source1: %{name}-%{version}-cargo.tar.gz
50-
Source2: 50-kata
51-
Source3: mariner-build-uvm.sh
5213

5314
BuildRequires: golang
54-
BuildRequires: git-core
55-
BuildRequires: libselinux-devel
56-
BuildRequires: libseccomp-devel
57-
BuildRequires: make
58-
BuildRequires: systemd
59-
BuildRequires: gcc
6015
BuildRequires: protobuf-compiler
61-
BuildRequires: azurelinux-release
62-
BuildRequires: dracut
63-
BuildRequires: kernel
64-
BuildRequires: busybox
65-
BuildRequires: cargo
6616
BuildRequires: rust
67-
BuildRequires: device-mapper-devel
17+
BuildRequires: libseccomp-devel
18+
BuildRequires: openssl-devel
6819
BuildRequires: clang
20+
BuildRequires: device-mapper-devel
21+
BuildRequires: cmake
6922

70-
Requires: busybox
71-
Requires: kernel
72-
Requires: libseccomp
73-
# Must match the version specified by the `assets.virtiofsd.version` field in
74-
# %{SOURCE0}/versions.yaml.
23+
Requires: kernel-uvm
24+
# Must match the version specified by the `assets.virtiofsd.version` field in the source's versions.yaml.
7525
Requires: virtiofsd = 1.8.0
7626

7727
%description
78-
Kata Containers is an open source project and community working to build a
79-
standard implementation of lightweight Virtual Machines (VMs) that feel and
80-
perform like containers, but provide the workload isolation and security
81-
advantages of VMs. https://katacontainers.io/.}
28+
The Kata Containers package ships the Kata components for Pod Sandboxing on AKS.
29+
The package sources are based on a Microsoft fork of the kata-containers project and tailored to the use
30+
for Mariner-based AKS node images.
8231

8332
%package tools
84-
Summary: Kata Tools package
85-
Requires: cargo
86-
Requires: curl
33+
Summary: Kata Containers tools package for building the UVM
8734

8835
%description tools
89-
This package contains the UVM osbuilder files
36+
This package contains the scripts and files required to build the UVM
9037

9138
%prep
9239
%autosetup -p1 -n %{name}-%{version}
93-
94-
cd %{_builddir}/%{name}-%{version}
40+
pushd %{_builddir}/%{name}-%{version}
9541
tar -xf %{SOURCE1}
96-
97-
# Not using gobuild here in order to stick to how upstream builds
98-
# (This builds multiple binaries)
99-
%build
100-
export PATH=$PATH:"$(pwd)/go/bin"
101-
export GOPATH="$(pwd)/go"
102-
export OPENSSL_NO_VENDOR=1
103-
104-
mkdir -p go/src/github.com/%{name}
105-
ln -s $(pwd)/../%{name}-%{version} go/src/github.com/%{name}/%{name}
106-
cd go/src/github.com/%{name}/%{name}
107-
108-
pushd src/runtime
109-
%make_build %{runtime_make_vars}
11042
popd
11143

112-
pushd src/agent
113-
%make_build %{agent_make_vars}
114-
touch kata-agent
44+
%build
45+
pushd %{_builddir}/%{name}-%{version}/tools/osbuilder/node-builder/azure-linux
46+
OS_VERSION=3.0 %make_build package
11547
popd
11648

117-
pushd tools/osbuilder
118-
# Manually build nsdax tool
119-
gcc %{build_cflags} image-builder/nsdax.gpl.c -o nsdax
120-
popd
49+
%define kata_path /opt/kata-containers
50+
%define kata_bin %{_prefix}/local/bin
51+
%define kata_shim_bin %{_prefix}/local/bin
52+
%define defaults_kata %{_prefix}/share/defaults/kata-containers
53+
%define tools_pkg %{kata_path}/uvm
12154

122-
# Not using gopkginstall here in order to stick to how upstream builds
12355
%install
124-
export GOPATH=$(pwd)/go
125-
export PATH=$PATH:$GOPATH/bin
126-
127-
cd go/src/github.com/%{name}/%{name}
128-
129-
install -m 0755 -D -t %{buildroot}%{katauvmdir} %{SOURCE3}
130-
install -m 0644 -D -t %{buildroot}%{katauvmdir} VERSION
131-
install -m 0644 -D -t %{buildroot}%{katauvmdir} versions.yaml
132-
install -D -m 0644 ci/install_yq.sh %{buildroot}%{katauvmdir}/ci/install_yq.sh
133-
sed --follow-symlinks -i 's#distro_config_dir="${script_dir}/${distro}#distro_config_dir="${script_dir}/cbl-mariner#g' tools/osbuilder/rootfs-builder/rootfs.sh
134-
135-
pushd src/runtime
136-
%make_install %{runtime_make_vars}
137-
# Ensure sed doesn't replace the configuration.toml symlink by a regular file.
138-
sed --follow-symlinks -i -e "s|image = .*$|initrd = \"%{katainitrddir}/kata-containers-initrd.img\"|" %{buildroot}%{kataconfigdir}/configuration.toml
139-
sed --follow-symlinks -i -e "s|kernel = .*$|kernel = \"%{kataclhdir}/vmlinux.bin\"|" %{buildroot}%{kataconfigdir}/configuration.toml
56+
pushd %{_builddir}/%{name}-%{version}/tools/osbuilder/node-builder/azure-linux
57+
START_SERVICES=no PREFIX=%{buildroot} %make_build deploy-package
58+
PREFIX=%{buildroot} %make_build deploy-package-tools
14059
popd
14160

142-
pushd src/agent
143-
%make_install %{agent_make_vars}
144-
popd
145-
146-
pushd tools/osbuilder
147-
rm .gitignore
148-
rm rootfs-builder/.gitignore
149-
mkdir -p %{buildroot}%{katalocalstatecachedir}
150-
151-
install -m 0755 -D -t %{buildroot}%{kataosbuilderdir} nsdax
152-
153-
cp -aR rootfs-builder %{buildroot}%{kataosbuilderdir}
154-
cp -aR image-builder %{buildroot}%{kataosbuilderdir}
155-
cp -aR initrd-builder %{buildroot}%{kataosbuilderdir}
156-
cp -aR scripts %{buildroot}%{kataosbuilderdir}
157-
cp -aR dracut %{buildroot}%{kataosbuilderdir}
158-
cp -aR Makefile %{buildroot}%{kataosbuilderdir}
159-
160-
rm -f %{buildroot}%{kataosbuilderdir}/image-builder/nsdax.gpl.c
161-
chmod +x %{buildroot}%{kataosbuilderdir}/scripts/lib.sh
162-
popd
163-
164-
# Install the CRI-O config drop-in file
165-
install -m 0644 -D -t %{buildroot}%{_sysconfdir}/crio/crio.conf.d %{SOURCE2}
61+
%files
62+
%{kata_bin}/kata-collect-data.sh
63+
%{kata_bin}/kata-monitor
64+
%{kata_bin}/kata-runtime
16665

167-
# Disable the image= option, so we use initrd= by default
168-
# The kernels kata-osbuilder creates are in /var/cache now, see rhbz#1792216
66+
%{defaults_kata}/configuration.toml
16967

170-
# Make symlinks in /usr/local/bin to /usr/bin where kata expects to find binaries
171-
mkdir -p %{buildroot}%{_prefix}/local/bin
172-
ln -sf %{_bindir}/containerd-shim-kata-v2 %{buildroot}%{_prefix}/local/bin/containerd-shim-kata-v2
173-
ln -sf %{_bindir}/kata-monitor %{buildroot}%{_prefix}/local/bin/kata-monitor
174-
ln -sf %{_bindir}/kata-runtime %{buildroot}%{_prefix}/local/bin/kata-runtime
68+
%{kata_shim_bin}/containerd-shim-kata-v2
17569

176-
%files
177-
# runtime
178-
%{_bindir}/containerd-shim-kata-v2
179-
%{_bindir}/kata-monitor
180-
%{_bindir}/kata-runtime
181-
%{_bindir}/kata-collect-data.sh
182-
%{_prefix}/local/bin/containerd-shim-kata-v2
183-
%{_prefix}/local/bin/kata-monitor
184-
%{_prefix}/local/bin/kata-runtime
185-
%dir %{_datadir}/defaults/kata-containers/
186-
%{_datadir}/defaults/kata-containers/configuration*.toml
187-
%{_datadir}/bash-completion/completions/kata-runtime
18870
%license LICENSE
18971
%doc CONTRIBUTING.md
19072
%doc README.md
19173

192-
# CRI-O drop-in file
193-
%{_sysconfdir}/crio/crio.conf.d/50-kata
194-
19574
%files tools
196-
# osbuilddir
197-
%dir %{kataosbuilderdir}
198-
%dir %{katalocalstatecachedir}
199-
%{kataosbuilderdir}/*
200-
201-
# agent
202-
%dir %{kataagentdir}
203-
%{kataagentdir}/*
204-
205-
%dir %{katauvmdir}
206-
%{katauvmdir}/VERSION
207-
%{katauvmdir}/versions.yaml
208-
%{katauvmdir}/mariner-build-uvm.sh
209-
%{katauvmdir}/ci/install_yq.sh
210-
211-
# Remove some scripts we don't use
212-
%exclude %{kataosbuilderdir}/rootfs-builder/alpine
213-
%exclude %{kataosbuilderdir}/rootfs-builder/centos
214-
%exclude %{kataosbuilderdir}/rootfs-builder/clearlinux
215-
%exclude %{kataosbuilderdir}/rootfs-builder/debian
216-
%exclude %{kataosbuilderdir}/rootfs-builder/template
217-
%exclude %{kataosbuilderdir}/rootfs-builder/ubuntu
75+
%dir %{kata_path}
76+
%dir %{tools_pkg}
77+
%dir %{tools_pkg}/tools
78+
%dir %{tools_pkg}/tools/osbuilder
79+
%{tools_pkg}/tools/osbuilder/Makefile
80+
81+
%dir %{tools_pkg}/tools/osbuilder/scripts
82+
%{tools_pkg}/tools/osbuilder/scripts/lib.sh
83+
84+
%dir %{tools_pkg}/tools/osbuilder/rootfs-builder
85+
%{tools_pkg}/tools/osbuilder/rootfs-builder/rootfs.sh
86+
%dir %{tools_pkg}/tools/osbuilder/rootfs-builder/cbl-mariner
87+
%{tools_pkg}/tools/osbuilder/rootfs-builder/cbl-mariner/config.sh
88+
%{tools_pkg}/tools/osbuilder/rootfs-builder/cbl-mariner/rootfs_lib.sh
89+
90+
%dir %{tools_pkg}/tools/osbuilder/image-builder
91+
%{tools_pkg}/tools/osbuilder/image-builder/image_builder.sh
92+
93+
%dir %{tools_pkg}/tools/osbuilder/node-builder
94+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux
95+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/Makefile
96+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/clean.sh
97+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/common.sh
98+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/uvm_build.sh
99+
100+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install
101+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr
102+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/bin
103+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/bin/kata-agent
104+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib
105+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib/systemd
106+
%dir %{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib/systemd/system
107+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib/systemd/system/kata-containers.target
108+
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib/systemd/system/kata-agent.service
218109

219110
%changelog
111+
* Fri Sep 20 2024 Manuel Huber <mahuber@microsoft.com> - 3.2.0.azl3-1
112+
- Upgrade to 3.2.0.azl3 release, refactor build instructions
113+
220114
* Tue Sep 03 2024 Neha Agarwal <nehaagarwal@microsoft.com> - 3.2.0.azl2-5
221115
- Add missing Distribution tag.
222116

@@ -321,7 +215,7 @@ ln -sf %{_bindir}/kata-runtime %{buildroot}%{_prefix}/local/bin/kata-runtime
321215
* Tue Sep 06 2022 Neha Agarwal <nehaagarwal@microsoft.com> - 2.5.0-4
322216
- Set DEFSANDBOXCGROUPONLY="false".
323217

324-
* Wed Sep 02 2022 Neha Agarwal <nehaagarwal@microsoft.com> - 2.5.0-3
218+
* Fri Sep 02 2022 Neha Agarwal <nehaagarwal@microsoft.com> - 2.5.0-3
325219
- Add kernel config to match guest and host cgroup setup.
326220
- Add patch to expose devices from kata.
327221

0 commit comments

Comments
 (0)