42 Commits

Author SHA1 Message Date
Ian Wienand
51fa51a1a3
Dockerfile: use containernetworking-plugins
It seems the containerfile elements are currently failing to have any
networking, meaning they can't update packages, etc.

There's some podman warnings along the lines of

 Error validating CNI config file
 /etc/cni/net.d/87-podman-bridge.conflist: [failed to find plugin
 \"bridge\" ...

which suggests to me containernetworking-plugins isn't installed.
Honestly I'm not sure why we aren't installing it ... it has iptables
as a dependency so we don't need to explicilty install that.

Add it to the install here

Change-Id: Ie1fe48691f44aa847859cf294404dd9e8b03cce8
2022-12-14 14:14:20 +11:00
Clark Boylan
38c25fb5dd Add Python 3.11 testing
This adds python 3.11 testing and drops python3.10 in order to keep
testing only the bounds of what Nodepool supports. Note that currently the
python 3.11 available for jammy is based on an RC release. This should
be fine as we do functional testing with a released python 3.11 and that
is what people will consume via the docker images.

Change-Id: Ia3e1c4976e35b254497e60d811f61a5531c69f1a
2022-11-30 13:44:52 -08:00
Ian Wienand
6c59182428 Dockerfile: move into separate group when running under cgroupsv2
Per the comments in

 https://github.com/containers/podman/issues/14884

there is basically no way to run podman nested in the container in a
cgroups v2 environment (e.g. Ubuntu Jammy) with the processes in the
same context the container starts in.

One option is to run systemd in the container, which puts things in
separate slices, etc.  This is unappealing.

This takes what I think is the simplest approach which is to check if
we're under cgroups v2 and move everything into a new group before
nodepool-builder starts.

The referenced change tests this by running the containerfile elements
on Jammy.

Neded-By: https://review.opendev.org/c/openstack/diskimage-builder/+/849274

Change-Id: Ie663d01d77e17f560a92887cba1e2c86b421b24d
2022-08-02 11:13:06 +10:00
Clark Boylan
bde9bdb975 Update to python3.10
This adds python 3.10 testing and updates our docker images to
python3.10.

On the docker image side of things we use opendev's python images which
are based on Debian then have python compiled on top of that external to
Debian python packaging. Debian bullseye ships with python3.9 but our
images come with python3.10. What this means is that we cannot rely on
external wheel caches for Debian bullseye + python3.9 here as we've got
the wrong version of python3.10. The good news is that all of the
dependencies that have historically given us trouble on arm64 in
particular already ship python3.10 aarch64/arm64 wheels. This means we
can rely on pypi as is. This is probably better for us anyway as it
decouples us from relying on additional external resources.

We also update a number of jobs to use nodeset: ubuntu-jammy as this
ubuntu version defaults to python 3.10.

Change-Id: I7fb585bc5ccc52803eea107e76dddf5e9fde8646
2022-07-01 12:05:26 -07:00
Zuul
dae31ef620 Merge "Add binutils to nodepool builder docker image" 2022-04-22 05:05:04 +00:00
Dr. Jens Harbott
21ae2c2378 Add binutils to nodepool builder docker image
When building Ubuntu 22.04 (Jammy), we need ``ar`` as extractor because
dpkg-deb on bullseye doesn't support the required compression algorithm.
Make sure that it is installed in the docker image.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: Icb0e40827c9f8ac583fa143545e6bed9641bf613
2022-04-21 16:48:46 +02:00
Ian Wienand
33e6b80f65 Docker image: use unstable debootstrap
As noted inline, use the unstable version of debootstrap to support
later distros.

In an effort to reduce the layers, refactor setting up the unstable
repo earlier where we install debootstrap.

Change-Id: I596d4e129b1617b9d4e52c0d9bc969db906ea4ff
2022-04-05 13:13:47 +10:00
Ian Wienand
43d3b21491 Dockerfile: explicitly install uidmap package
As noted inline, we are having problems running podman on the
production hosts (why this doesn't happen in the gate is still a
mystery...).  Explicitly install uidmap package alongside podman.

Change-Id: Ic7817cf1b1279dfde5b4cf9538f5067176024b73
2022-02-02 15:03:27 +11:00
Ian Wienand
bf112d5522 Dockerfile: install podman from unstable
Due to the issues in the bug outlined inline, we need a more recent
podman for the DIB containerfile element with recent distros like
Fedora 35.  Install from unstable until these fixes make it into the
stable package.

Change-Id: I6ce1e9c61c0a38dde667efd1fc1f6ba86dfee6e2
2021-10-28 16:42:16 +11:00
Ian Wienand
cce7dbc669 Use bullseye podman in container
After updating images to bullseye
(I21cfbd3935e48be4b92591ea36c7eed301230753) we can use the native
podman packages.  These are slightly older, but should be fine for the
intended usages.

Change-Id: Ica62392ebf4a665a04cd65458dda9e0a7545ccc8
2021-10-28 08:35:19 +11:00
Ian Wienand
f5d015c883 Update Docker and bindep for Bullseye base images
Similar to Zuul (I71182e9d3e6e930977a9f983b37743ee3300ec91), the base
images have updated to Bullseye.

This updates various things to get a building Bullseye image.

We have upgrade to 3.9-based images here because OpenDev builds ARM64
wheels for a bullseye+arm64 combo, which we use to speed up the ARM64
cross-build (we do not have any repository of <3.7|3.8>+bullseye ARM64
wheels, so it makes it difficult to use these combos as the
cross-build can take a very long time)

Depends-On: https://review.opendev.org/c/openstack/diskimage-builder/+/806318
Change-Id: I21cfbd3935e48be4b92591ea36c7eed301230753
2021-10-26 11:11:19 +11:00
Ian Wienand
11029a788a Dockerfile: podman -- handle new configuration file
Configuration has all moved to containers.conf; write the cgroup
option into that.  Also disable log messages trying to go to systemd,
which puts out warnings about the journal socket not existing.

Change-Id: Ia4d31d826daf6f9b43757b8b4ae446092afd42c8
2021-05-11 11:34:50 +10:00
Ian Wienand
f7ed327f81 Dockerfile: podman -- install recommends
It seems some packages that are really quite important are only
recommends depdencies and cause failures when dib containerfile
element tries start podman for extracting base images.  Add
--install-recommends.

Since the podman things are getting a little complex now, consolidate
them into one section for clarity.

Change-Id: Ie77ee0a0c5318d8c12eb1b0e68b3b6fa8358ece0
2021-05-11 09:44:35 +10:00
Ian Wienand
2c8b40d7ef Dockerfile: podman -- disable metacopy option
If the kernel in the container doesn't support this option it causes
podman to fail to start when using the containerfile dib element.
Disable metacopy option for compatability.

Change-Id: I168bd1a50b6b20da051b00c3e88daedb5ed6e5e9
2021-05-11 09:44:23 +10:00
Ian Wienand
a07bb0a0ae Install podman in container for container-based builds
This installs podman inside the nodepool container, which is used by
the dependent change in DIB to extract initial chroot environments
from upstream containers.  This eliminates the need to run non-native
tools on build hosts (rpm/zypper on Ubuntu, etc.).

As noted in the config, podman defaults to assuming systemd is
installed and using various systemd interfaces.

Additionally, we map the a volume into the container which allows
nested podman to do what it needs to do.

Needed-By: https://review.opendev.org/700083
Change-Id: I6722aa2b32db57e099dae4417955a8a2cd28847e
2021-05-05 10:34:42 +10:00
Ian Wienand
549c87959a Dockerfile: add xz-utils
This lets DIB elements extract .tar.xz files

Change-Id: I109ccd6bce937bfe5b72974955387b98adabecd9
2020-09-10 08:50:08 +10:00
Clark Boylan
7b55d54365 Install gdisk/dosfstools on nodepool-builder images
gdisk includes sgdisk which is used to create GPT partitions on disks.
EFI partitions are vfat so need dosfstools.  This is used by DIB when
creating images with a EFI setup as with arm64 image builds.

Change-Id: I57891d6890a3db6acb42c149c3a05ab25f423385
2020-09-09 10:08:48 +10:00
Clark Boylan
ed42e5535b Build arm64 images using arm64 wheels from openstack if available
We updated python-base and python-builder to include arm64 images in
support of nodepool's arm64 python-builder image. In doing so we have
discovered a number of issues, but the biggest is slowness of building
python packages in an emulated environment.

In order to speed up package builds we consume the OpenDev linaro
cloud arm64 wheel cache. This doesn't have wheels for every package we
need, but for the things that it does have it will speed up our builds.

One of the risks with this setup is that we're relying on wheels built
for openstack on arm64 and those follow openstack's contraints. In order
to mitigate this risk we set pip install's --prefer-binary flag in the
pip.conf. This means that if openstack's constraints lag what is
availale on pypi we should use the existing wheels as long as they are
valid version according to requirements rather than trying to build from
sdist.

Co-Authored-By: James E. Blair <corvus@inaugust.com>
Co-Authored-By: Ian Wienand <iwienand@redhat.com>
Change-Id: I3b358721eebbceafc12daf9d706306634048b196
2020-09-03 14:02:21 -07:00
Clark Boylan
5f915f33ba Update bindep and vhd-util install for arm64
These two change are required for arm64 but are also fine for x86
builds. Lets get these in before adding arm64 image jobs as it
simplifies the juggling we have to do with the various fixes.

Change-Id: I051bd0d80fa556111cb36d52391dca264f17015c
2020-09-01 08:37:06 -07:00
Zuul
5cd0f371c5 Merge "Dockerfile: use local openstack-ci-core PPA key" 2020-05-07 21:24:17 +00:00
Monty Taylor
ad625b8d8c Build nodepool with python3.8
We updated the zuul images to py3.8, let's update the nodepool ones
too.

Change-Id: Id4b9c00d14c5fb0dd192760084c6563a8bae3636
2020-05-05 09:23:02 -05:00
Ian Wienand
043a4258fc Dockerfile: use local openstack-ci-core PPA key
We see timeouts trying to get this key fairly frequently in the gate.
Store it locally and use that in the container build.

Change-Id: Ifd706849f1fad88c8ec4afc79090df4afb88abb4
2020-04-30 17:32:02 +10:00
Monty Taylor
ed75d0536b Actually install extras from nodepool_base
We added two packages to extras so that they'd end up in the
container images, but we never told anything to install them.
It became clear that that's confusing, so we added an api
to python-builder to allow specifying a list of extras to
install.

Depends-On: https://review.opendev.org/722125
Change-Id: I27e10822744863560febcdad8bab9a4f3cf8fc8e
2020-04-22 15:01:30 -05:00
Ian Wienand
edba92e412 Dockerfile: incorporate workaround deboostrap
As described in the updated comment section, this debootstrap from the
openstack-ci PPA works around some issues building inside a container.

Change-Id: I0887a801bb6dd4ce992c39d9e332a18f8194a7b9
2020-04-22 10:40:38 +10:00
Monty Taylor
a4970ca935 Pin docker images to 3.7 explicitly
We have versioned base images now. Pin to 3.7 (the current default)
so that we're explicit. We can update to 3.8 in a followup if we
want to.

Depends-On: https://review.opendev.org/714532
Change-Id: I6f92682b2d7c402af0a77183a71a6fdb2a1fac7d
2020-03-26 09:08:14 -05:00
Monty Taylor
6da36e8a3e Revert abitrary uid support
This code was already reverted in the zuul images, it doesn't
actually provide the value is claims to add and it breaks the
running under podman.

Revert "Dockerfile: add support for arbritary uid"

This reverts commit da2701e0b19cbe75cdbd79cfeafaf7c643546fc7.

Revert "Dockerfile: add user to shadow file too"

This reverts commit 747e95726362dc5d57c35a9bdcd806d3ab1d7d32.

Change-Id: Iff606c65c6a3223f13d963d90455fa895193cce8
2020-03-16 14:20:42 -07:00
Clark Boylan
80d7205b06 Add visual dividers for each image in Dockerfile
Our dockerfiles describe the building of many images. Some are temporary
and others persist to publishing, but they all have specific roles and
knowing where to apply changes is important. Unfortanately, it is hard
to see that by default. Experiment with the addition of ==== barrier
lines to give people a visual cue for the divisions.

Change-Id: If28e0bd94a4d65f0623c56e9a589615dd04d2e75
2020-03-13 09:06:34 -07:00
Monty Taylor
334dfdc77c Be explicit about base image source
podman configs can't guarantee that these are pointing at
docker.io, so just be explicit.

Change-Id: If7e1043a88c4c143505ce4e1dbf6a9d6ee89d2de
2020-03-12 16:24:49 -05:00
Clark Boylan
6c915cdbd3 Install zypper on the nodepool-builder image
This allows you to build suse images with dib in nodepool-builder
container image.

Change-Id: Ib7ffe99c7f8f961857cf27d0a6ecba7b6bd57b26
2020-03-10 13:42:30 -07:00
Tristan Cacqueray
cabfbcd6ae Dockerfile: create a nodepool user with uid 10001
This change creates an unprivileged user nodepool (uid 10001) to run the
nodepool services.

Change-Id: Ia4f598ec2d43409cbb80a33f35cf8fb129de9f72
2020-02-03 20:28:59 +00:00
Mohammed Naser
d694cc087b Add procps to packages in Dockerfile
There are some DIB methods which need to use it which means
that DIB image builds will fail without it (and procps is
not included in the base Docker image)

Change-Id: I3cf3ce765a91a93e72465739ce68bc1238955126
2019-12-18 11:32:13 -05:00
Monty Taylor
bcfdd9820a Add debootstrap to builder package list
We need this to build debian repos until container-base element is
done.

Change-Id: I9f2c51e726ce610a4269c0e6a27ca1dd13779f91
2019-12-18 10:40:17 -05:00
Monty Taylor
46d0ce2483 Dockerfile: install nodepool-builder dependencies
vhd-util is needed for targetting Rackspace. debian-keyring is
needed for debian images, ubuntu-keyring for ubuntu images and
yum for red hat images.

Note the sibling build will have installed many of these from the
bindep.txt file from diskimage-builder itself.  However, when using
releases this is not done.  These installs should be a no-op for the
sibling containers.

Change-Id: I35bc6a2a07fda229acfd53a2a34227d6475495a8
2019-12-16 12:37:19 +11:00
Ian Wienand
2d9958f738 Also build sibling container images
These are tagged as sibling images, and use openstacksdk/dib from Zuul
checkouts.  Since we don't want them released to dockerhub, keep the
job separate.

Change-Id: Ifa151e3fb91a8705872989f7d70755e21bb5bf0b
2019-12-16 12:37:19 +11:00
Ian Wienand
a64649bb7c Dockerfile: add DEBUG environment flag
This checks environment variable DEBUG,, and if set will start the
daemons with "-d" instead of "-f".  We need the unquoted version of
CMD so that arguments are expanded.

Change-Id: I12685e2b147fc77270678f72bcc18eb429edcb2d
2019-12-16 12:37:17 +11:00
Ian Wienand
3db0f3602c Dockerfile: install sudo for nodepool-builder
DIB needs sudo to build.

To make it so we only add the sudoers file for nodepool to the builder
image make it so we have a "-base" image, then hang the nodepool,
nodepool-launcher and nodepool-builder images off that.

Change-Id: Ia56aa2f549b8699c382a905708abd55ca2f100af
2019-12-11 16:15:30 +11:00
Ian Wienand
960d2a00df Dockerfile: create APP_DIR
The APP_DIR directory isn't created, so the container can't start.

Create it and make sure it's owned by the nodepool (10001) user.

Change-Id: Ic119c48482d7bd8f35b6dbb7bf7f350059ec94fc
2019-12-11 16:15:30 +11:00
Ian Wienand
747e957263 Dockerfile: add user to shadow file too
Without an entry in the shadow file, this user can't use sudo with the
following error:

 account validation failure, is your account locked

(which I include here for future googling because it's pretty obscure,
you have to have this odd situation, or a pretty broken PAM to see it).

The "nodepool" user (10001) is in the root group, which is why the
uid_entrypoint script can update the /etc/passwd file.  We need to
change the ownership of the /etc/shadow file for this to work.  It
feels a bit weird, but there's no password to actually guess anyway.

Change-Id: I8846757edffe31f96df58999d05727910c9fca43
2019-12-05 10:27:22 +11:00
Tristan Cacqueray
da2701e0b1 Dockerfile: add support for arbritary uid
This change adds the uid_entrypoint script to support arbitrary uid
as documented in:
https://github.com/RHsyseng/container-rhel-examples/tree/master/starter-arbitrary-uid

Change-Id: I857308fa1f2363d2b4bc257e86963c36ce1d49e2
2019-04-10 12:20:21 +00:00
Mohammed Naser
6b9af280df
docker: don't daemonize when starting images
This patch makes the nodepool process avoid starting up as a daemon in
the Docker images, as it's not meant to become a background process
within a container. In order to have consistent logging like in the
daemonized mode we need to add a new foreground option that runs in
foreground but without debug logging.

Change-Id: I77e9e6e4f94cf726336419a2b22916cc1e974e62
Co-Authored-By: Tobias Henkel <tobias.henkel@bmw.de>
2019-02-08 20:53:04 +01:00
Monty Taylor
85e67f0bb9 Stop building an explicit nodepool-base image
We have a utility image that we use for running the nodepool command
that doens't have any additional software installed. Although it does
set a COMMAND of /usr/local/bin/nodepool, it could still be useful as
a general base image for other people if they wanted such a thing.

Change-Id: I894e3d2dbe3cd2017f27ccc5e6fe298e9c9abd03
2019-01-24 16:12:24 +00:00
James E. Blair
f274c0f6bf
Build images with Dockerfile instead of pbrx
Use the opendevorg/python-builder image to build nodepool images
with a Dockerfile and multi-stage builds.

bindep wasn't installing gcc for dpkg. Remove the platform restrictions
for it.

Change-Id: I0282b75ffad3d0ae1b589381010a3d4273fceb07
2019-01-24 16:11:12 +00:00