|
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 |
9 | 1 | %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 | + |
41 | 3 | 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 |
44 | 7 | License: ASL 2.0 |
45 | 8 | URL: https://github.com/microsoft/kata-containers |
46 | 9 | Vendor: Microsoft Corporation |
47 | 10 | Distribution: Azure Linux |
48 | 11 | Source0: https://github.com/microsoft/kata-containers/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz |
49 | 12 | Source1: %{name}-%{version}-cargo.tar.gz |
50 | | -Source2: 50-kata |
51 | | -Source3: mariner-build-uvm.sh |
52 | 13 |
|
53 | 14 | BuildRequires: golang |
54 | | -BuildRequires: git-core |
55 | | -BuildRequires: libselinux-devel |
56 | | -BuildRequires: libseccomp-devel |
57 | | -BuildRequires: make |
58 | | -BuildRequires: systemd |
59 | | -BuildRequires: gcc |
60 | 15 | BuildRequires: protobuf-compiler |
61 | | -BuildRequires: azurelinux-release |
62 | | -BuildRequires: dracut |
63 | | -BuildRequires: kernel |
64 | | -BuildRequires: busybox |
65 | | -BuildRequires: cargo |
66 | 16 | BuildRequires: rust |
67 | | -BuildRequires: device-mapper-devel |
| 17 | +BuildRequires: libseccomp-devel |
| 18 | +BuildRequires: openssl-devel |
68 | 19 | BuildRequires: clang |
| 20 | +BuildRequires: device-mapper-devel |
| 21 | +BuildRequires: cmake |
69 | 22 |
|
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. |
75 | 25 | Requires: virtiofsd = 1.8.0 |
76 | 26 |
|
77 | 27 | %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. |
82 | 31 |
|
83 | 32 | %package tools |
84 | | -Summary: Kata Tools package |
85 | | -Requires: cargo |
86 | | -Requires: curl |
| 33 | +Summary: Kata Containers tools package for building the UVM |
87 | 34 |
|
88 | 35 | %description tools |
89 | | -This package contains the UVM osbuilder files |
| 36 | +This package contains the scripts and files required to build the UVM |
90 | 37 |
|
91 | 38 | %prep |
92 | 39 | %autosetup -p1 -n %{name}-%{version} |
93 | | - |
94 | | -cd %{_builddir}/%{name}-%{version} |
| 40 | +pushd %{_builddir}/%{name}-%{version} |
95 | 41 | 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} |
110 | 42 | popd |
111 | 43 |
|
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 |
115 | 47 | popd |
116 | 48 |
|
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 |
121 | 54 |
|
122 | | -# Not using gopkginstall here in order to stick to how upstream builds |
123 | 55 | %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 |
140 | 59 | popd |
141 | 60 |
|
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 |
166 | 65 |
|
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 |
169 | 67 |
|
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 |
175 | 69 |
|
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 |
188 | 70 | %license LICENSE |
189 | 71 | %doc CONTRIBUTING.md |
190 | 72 | %doc README.md |
191 | 73 |
|
192 | | -# CRI-O drop-in file |
193 | | -%{_sysconfdir}/crio/crio.conf.d/50-kata |
194 | | - |
195 | 74 | %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 |
218 | 109 |
|
219 | 110 | %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 | + |
220 | 114 | * Tue Sep 03 2024 Neha Agarwal <nehaagarwal@microsoft.com> - 3.2.0.azl2-5 |
221 | 115 | - Add missing Distribution tag. |
222 | 116 |
|
@@ -321,7 +215,7 @@ ln -sf %{_bindir}/kata-runtime %{buildroot}%{_prefix}/local/bin/kata-runtime |
321 | 215 | * Tue Sep 06 2022 Neha Agarwal <nehaagarwal@microsoft.com> - 2.5.0-4 |
322 | 216 | - Set DEFSANDBOXCGROUPONLY="false". |
323 | 217 |
|
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 |
325 | 219 | - Add kernel config to match guest and host cgroup setup. |
326 | 220 | - Add patch to expose devices from kata. |
327 | 221 |
|
|
0 commit comments