Commit Graph

146 Commits

Author SHA1 Message Date
Derek Lee
0e40ecf383 tools/snap: simplify nproc
Replaces calls of nproc	with nproc with

nproc ${CI:+--ignore 1}

to run nproc with one less processing unit than the maximum to prevent
DOS-ing the local machine.

If process is being run in a container (determined via whether $CI is
null), all processing units avaliable will be used.

Fixes #3967

Signed-off-by: Derek Lee <derlee@redhat.com>
2022-07-06 15:04:08 -07:00
James O. D. Hunt
e11fcf7d3c
Merge pull request #4168 from Champ-Goblem/patch/fix-chronyd-failure-on-boot
rootfs: Fix chronyd.service failing on boot
2022-06-21 09:43:13 +01:00
Eric Ernst
7c4049aabb osbuilder: add iptables package
Since we are introducing an agent API for interacting with guest
iptables, let's ensure that our example rootfs' have iptables-save/restore
installed.

Fixes: #4356

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-05-31 09:21:02 -07:00
Gabriela Cervantes
24a2b0f6a2 docs: Remove clear containers reference in README
This PR removes the clear containers reference as this is not longer
being used and is deprecated at the rootfs builder README.

Fixes #4278

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-05-18 14:53:17 +00:00
Champ-Goblem
1b7fd19acb rootfs: Fix chronyd.service failing on boot
In at least kata versions 2.3.3 and 2.4.0 it was noticed that the guest
operating system's clock would drift out of sync slowly over time
whilst the pod was running.

This had previously been raised and fixed in the old reposity via [1].
In essence kvm_ptp and chrony were paired together in order to
keep the system clock up to date with the host.

In the recent versions of kata metioned above,
the chronyd.service fails upon boot with status `266/NAMESPACE`
which seems to be due to the fact that the `/var/lib/chrony`
directory no longer exists.

This change sets the `/var/lib/chrony` directory for the `ReadWritePaths`
to be ignored when the directory does not exist, as per [2].

[1] https://github.com/kata-containers/runtime/issues/1279
[2] https://www.freedesktop.org/software/systemd
/man/systemd.exec.html#ReadWritePaths=

Fixes: #4167
Signed-off-by: Champ-Goblem <cameron_mcdermott@yahoo.co.uk>
2022-04-29 17:15:29 +01:00
GabyCT
a07956a369
Merge pull request #3966 from devimc/2022-03-22/fixOsbuilderQAT
osbuilder/qat: don't pull kata sources if exist
2022-03-25 15:12:03 -06:00
Julio Montes
c27963276b osbuilder/qat: don't pull kata sources if exist
don't pull kata sources if they already exist under GOPATH

fixes #3965

Signed-off-by: Julio Montes <julio.montes@intel.com>
2022-03-25 09:09:52 -06:00
Julio Montes
459f4bfedb osbuilder/qat: use centos as base OS
move away from ubuntu, since now it's easier to build using
CentOS as base OS

fixes #3936

Signed-off-by: Julio Montes <julio.montes@intel.com>
2022-03-24 08:18:29 -06:00
James O. D. Hunt
3edf25b6c9
Merge pull request #3682 from Jakob-Naucke/cross
Multistrap Ubuntu & enable cross-building guest
2022-03-21 11:11:47 +00:00
James O. D. Hunt
5d6d39be48 scripts: Change here document delimiters
Fix the outstanding scripts using non standard shell here document delimiters.

This should have been caught by
https://github.com/kata-containers/tests/pull/3937, but there is a bug
in the checker which is fixed on
https://github.com/kata-containers/tests/pull/4569.

Fixes: #3864.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-10 09:23:37 +00:00
Jakob Naucke
72f7e9e300
osbuilder: Multistrap Ubuntu
Use `multistrap` for building Ubuntu rootfs. Adds support for building
for foreign architectures using the `ARCH` environment variable.
In the process, the Ubuntu rootfs workflow is vastly simplified.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
0a313eda1c
osbuilder: Fix use of LIBC in rootfs.sh
- Add a doc comment
- Pass to build container, e.g. to build x86_64 with glibc (would
  always use musl)

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
2c86b956fa
osbuilder: Simplify Rust installation
no double export, direct target

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
0072cc2b66
osbuilder: Remove musl installations
Remove a lot of cruft of musl installations -- we needed those for the
Go agent, but Rustup just takes care of everything. aarch64 on
Debian-based & Alpine is an exception -- create a symlink
`aarch64-linux-musl-gcc` to `musl-tools`'s `musl-gcc` or `gcc` on
Alpine. This is unified -- arch-specific Dockerfiles are removed.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
5c3e553624
osbuilder: apk add --no-cache
Hadolint DL3019. If you're wondering why this is in this PR, that's
because I touch the file later, and we're only triggering the lints for
changed files.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
573a37b33b
osbuilder: Add CentOS Stream rootfs
to cover a Red Hat (adjacent) rootfs with great cross-platform compatibility
and a workable release cadence. The previous CentOS & Fedora workflows are
simplified.

Also remove unnecessary `/usr/share` files as on Ubuntu and mark Alpine
as unuspported on ppc64le (due to musl, for a while already).

Fixes: #3340
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-14 15:06:07 +01:00
Jakob Naucke
f10642c82b
osbuilder: Source .cargo/env before checking Rust
We install Rust in the build containers, but we also install Rust in
`rootfs.sh` if it is missing. It makes sense to install Rust in the build
containers so it does not have to be installed every time, but for that check
to work on non-login shells, we should source `.cargo/env` before running it.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-14 15:06:07 +01:00
Bin Liu
cf53ec2c71
Merge pull request #2977 from luodw/support_nydus
feature(nydusd): add nydusd support to introduce lazyload ability
2022-02-14 13:08:50 +08:00
luodaowen.backend
2d9f89aec7 feature(nydusd): add nydusd support to introduse lazyload ability
Pulling image is the most time-consuming step in the container lifecycle. This PR
introduse nydus to kata container, it can lazily pull image when container start. So it
can speed up kata container create and start.

Fixes #2724

Signed-off-by: luodaowen.backend <luodaowen.backend@bytedance.com>
2022-02-11 21:41:17 +08:00
Daniel Höxtermann
b19b6938a8 docs: Fix relative links in Markdown
Relative links within this repository allow for easier navigation to
the corresponding file / directory in the current commit / for the
selected version.

Link text was slightly changed / fixed in
- docs/Unit-Test-Advice.md
- docs/how-to/how-to-run-docker-with-kata.md

Fixes #3045

Signed-off-by: Daniel Höxtermann <daniel@hxtm.dev>
2022-02-11 13:49:42 +01:00
Manabu Sugimoto
df6ae1e789 osbuilder: Remove libseccomp from Dockerfile
Remove the libseccomp package from Dockerfile of `alpine` and `clearlinux`
because the libseccomp library is installed by the `ci/install_libseccomp.sh`
script when building the kata-agent.

Fixes: #3508

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-01-21 00:32:57 +09:00
Carlos Venegas
5f41e199dd
Merge pull request #3438 from haslersn/usr-bin-env-bash
scripts: Use shebang /usr/bin/env bash
2022-01-17 15:39:42 -06:00
Sebastian Hasler
adffd3f8b6 scripts: Use shebang /usr/bin/env bash
Not all distros have `/bin/bash`, e.g. NixOS.

Fixes: #3450

Signed-off-by: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
2022-01-13 22:53:28 +01:00
Fabiano Fidêncio
e4b7a12bf3 qat: Add Debian to the distro examples
Debian is a supported rootfs that uses systemd as init, thus, it should
be mentioned in the QAT README document.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-13 21:54:05 +01:00
Fabiano Fidêncio
6979d5be69 osbuilder: Remove gentoo rootfs-builder
As the gentoo rootfs is not tested in our CI, we can't guarantee it
actually works as expected.

Whenever we have someone willing to maintain this rootfs we can have it
added back, and also add a CI job to test it altogether, avoiding then
any possible regression.

Fixes: #2144

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-13 21:54:05 +01:00
Fabiano Fidêncio
22c1a093d7 osbuilder: Remove suse rootfs-builder
As the suse rootfs is not tested in our CI, we can't guarantee it
actually works as expected.

Whenver we have someone willing to maintain this rootfs we can have it
added back, and also add a CI job to test it altogether, avoiding then
any possible regression.

Fixes: #2145

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-13 21:54:05 +01:00
Fabiano Fidêncio
85dd587382 osbuilder: Remove fedora rootfs-builder
As the fedora rootfs is not tested in our CI, we can't guarantee it
actually works as expected.

Whenever we have someone willing to maintain the rootfs we can have it
added back, and also add a CI job to test it altogether, avoiding then
any possible regression.

Fixes: #2143

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-13 21:54:05 +01:00
Fabiano Fidêncio
06fae29f49 osbuilder: Remove centos rootfs-builder
As the centos rootfs is not tested in our CI, we can't guarantee it
actually works as expected.

Whenever we have someone willing to maintain the rootfs we can have it
added back, and also add a CI job to test it altogether, avoiding then
any possible regression.

Fixes: #2140

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-13 21:54:05 +01:00
Bin Liu
b2166560fa
Merge pull request #3375 from zhaojizhuang/debianrootfs
osbuilder: Restore Debian as a rootfs
2022-01-05 10:27:47 +08:00
zhaojizhuang
3093f93a6f osbuilder: Restore Debian as a rootfs
Restore Debian as a rootfs.
1. revert of #3154, but some change
2. update debian version to 10.11
3. update  `libstdc++-6-dev` to `libstdc++-8-dev`
4.  changes discarded in QAT are not restored

Fixes: #3372
Signed-off-by: zhaojizhuang <571130360@qq.com>
2022-01-04 11:54:34 +08:00
Wainer Moschetta
820dc930db
Merge pull request #3109 from wainersm/delint_dockerfiles
Delint dockerfiles
2021-12-28 10:11:51 -03:00
Fabiano Fidêncio
67f0ab4092
Merge pull request #3294 from Kvasscn/kata_dev_osbuilder_makefile
osbuilder: avoid to copy versions.txt which already deprecated
2021-12-21 16:07:01 +01:00
Wainer dos Santos Moschetta
aeb2b673b3 osbuilder: delint dockerfiles
Removed all errors/warnings pointed out by hadolint version 2.7.0, except for the following
ignored rules:
  - "DL3008 warning: Pin versions in apt get install"
  - "DL3041 warning: Specify version with `dnf install -y <package>-<version>`"
  - "DL3033 warning: Specify version with `yum install -y <package>-<version>`"
  - "DL3048 style: Invalid label key"
  - "DL3003 warning: Use WORKDIR to switch to a directory"
  - "DL3018 warning: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>"
  - "DL3037 warning: Specify version with zypper install -y <package>[=]<version>"

Fixes #3107
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2021-12-21 09:54:44 -05:00
Fabiano Fidêncio
99ef52a35d osbuilder: Add protoc to the alpine container
It seems the lack of protoc in the alpine containers is causing issues
with some of our CIs, such as the VFIO one.

Fixes: #3323

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2021-12-21 13:57:18 +01:00
zhanghj
d1bc409d57 osbuilder: avoid to copy versions.txt which already deprecated
Currently the versions.txt in rootfs-builder dir is already removed,
so avoid to copy it in list of helper files.

Fixes: #3267

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2021-12-17 17:23:05 +08:00
bin
3f7cf7ae67 osbuilder: show usage if no options/arguments specified
Now if no options/arguments specified, the shell scripts will return an error:

ERROR: Invalid rootfs directory: ''

This commit will show usage if no options/arguments specified.

Fixes: #3256

Signed-off-by: bin <bin@hyper.sh>
2021-12-13 16:10:55 +08:00
Bin Liu
978b13c9e8
Merge pull request #3235 from Kvasscn/kata_dev_image_builer_help
image_build: add help info for '-f' option and 'BLOCK_SIZE' env.
2021-12-09 22:55:24 +08:00
Julio Montes
70062e1563
Merge pull request #3238 from snir911/wip/build_with_runtime
osbuilder: be runtime consistent with podman build
2021-12-09 08:06:00 -06:00
Snir Sheriber
2ebaaac73d osbuilder: be runtime consistent also with podman build
Use the same runtime used for podman run also for the podman build cmd
Additionally remove "docker" from the docker_run_args variable

Fixes: #3239
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2021-12-09 11:28:16 +02:00
Jakob Naucke
2204ecac39
versions: Upgrade Alpine, using minor version
- Upgrade Alpine guest rootfs to 3.15
- Specify a minor version rather than patch level as the Alpine
  repositories use that.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-12-08 15:18:44 +01:00
Jakob Naucke
dfd0732ff9
osbuilder: Revert to using apk.static for Alpine
#2399 partially reverted #418, missing on returning to bootstrapping a
rootfs with `apk.static` instead of copying the entire root, which can
result in drastically larger (more than 10x) images. Revert this as well
(requires some updates to URL building).

Fixes: #3216
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-12-08 15:18:43 +01:00
zhanghj
6b3e4c212c image_build: add help info for '-f' option and 'BLOCK_SIZE' env.
The help information of '-f' option is missing, and same issue
with 'BLOCK_SIZE' env variables, fix it in usage() function.

Fixes: #3231

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2021-12-08 17:33:07 +08:00
Gabriela Cervantes
923e098db6 osbuilder: Remove debian as a rootfs
Currently we do not have debian as part of the kata CI as we
do not have a mantainer, this PR removes debian as a supported
rootfs in order to have only the distros that we are supporting
and mantainining.

Fixes #3153

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2021-11-30 19:31:33 +00:00
Binbin Zhang
8ee67aae4f osbuilder: fix missing cpio package when building rootfs-initrd image
1. install cpio package before building rootfs-initrd image
2. add `pipefaili;errexit` check to the scripts

Fixes: #3144

Signed-off-by: Binbin Zhang <binbin36520@gmail.com>
2021-11-29 23:42:44 +08:00
Peng Tao
f59d3ff600 osbuilder: add coreutils to guest rootfs
So that the debug console is more useful. In the meantime, remove
iptables as it is not used by kata-agent any more.

Fixes: #3138
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-11-29 11:22:07 +08:00
Julio Montes
857501d8dd tools/osbuilder: build QAT kernel in fedora 34
kernel compiled in fedora 35 (latest) is not working, following error
is reported:

```
qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF
Note
```

Build QAT kernel in fedora 34 container to fix it

fixes #3135

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-11-26 13:56:43 -06:00
Wainer dos Santos Moschetta
a239a38f45 osbuilder: build image-builder image from Fedora 34
Currently the image-builder image is built from `fedora:latest` and
this is error-prone as any update of the base image can lead to
breakage. Instead let's create the image from Fedora 34, which is the
last known version to build fine.

Fixes #2960
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2021-11-03 13:07:42 -04:00
Manabu Sugimoto
a3647e3486 osbuilder: Set up libseccomp library
The osbuilder needs to set up libseccomp library to build the kata-agent
because the kata-agent supports seccomp currently.
The library is built from the sources to create a static library for musl libc.
In addition, environment variables for the libseccomp crate are set to
link the library statically.

Fixes: #1476

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-10-27 19:06:13 +09:00
Eric Adams
37fa453dd2 osbuilder: Update QAT driver in Dockerfile
This is to bump the OOT QAT 1.7 driver version to the
latest version. I dida test on my QAT enabled system and
everything functioned as expected.

Fixes: #2877

Signed-off-by: Eric Adams <eric.adams@intel.com>
2021-10-22 00:08:24 +00:00
Wainer dos Santos Moschetta
50da26d3e6 osbuilder: Call detect_rust_version() right before install_rust.sh
When building with dracut method the build_rootfs_distro() is not called, in turn
detect_rust_version() isn't either, so the install_rust.sh script is gave a null
rust version. This changed the script to call detect_rust_version() right before
install_rust.sh.

Related to commit: f34f67d610
Fixes #2862
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2021-10-18 16:54:53 -04:00