Skip to content

Commit

Permalink
WIP: Try bumping builder base image to 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenhorsman committed Feb 11, 2025
1 parent f365ffa commit 14e6d35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/podvm/Dockerfile.podvm_builder
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Creates a builder container image that should be used to build the Pod VM
# disk inside a container.
#
FROM ubuntu:20.04
FROM ubuntu:24.04

ARG ARCH="amd64"
ARG YQ_ARCH="amd64"
Expand Down
26 changes: 18 additions & 8 deletions src/cloud-api-adaptor/podvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ In order to build locally it requires the source trees and softwares mentioned i
* On Ubuntu:

```bash
$ apt-get install -y qemu-kvm cloud-utils qemu-utils protobuf-compiler pkg-config libdevmapper-dev libgpgme-dev
apt-get install -y qemu-kvm cloud-utils qemu-utils protobuf-compiler pkg-config libdevmapper-dev libgpgme-dev
```

Finally run the following commands to build the qcow2 image:

```bash
$ export CLOUD_PROVIDER=[aws|azure|ibmcloud|libvirt|vsphere|generic]
$ make image
export CLOUD_PROVIDER=[aws|azure|ibmcloud|libvirt|vsphere|generic]
make image
```

**NOTE:** "generic" is a best-effort provider agnostic image creation

# How to build within container
Expand Down Expand Up @@ -47,11 +48,13 @@ Fedora 39 ([Dockerfile.podvm_builder.fedora](./Dockerfile.podvm_builder)) and RH
([Dockerfile.podvm_builder.rhel](./Dockerfile.podvm_builder.rhel)).

You can create the builder image using the make target by running:

```bash
$ make -C .. podvm-builder
make -C .. podvm-builder
```

You can optionally customize the builder image, by specify shell variables to the `make` command:

| Variable | Default value | Description |
| ------------------- | -------------- | --------------------------------------------------------------- |
| `ARCH` | `amd64`/`s390x`| Architecture of the podvm image to be built. Defaults to the architecture the of the current machine |
Expand All @@ -60,6 +63,7 @@ You can optionally customize the builder image, by specify shell variables to th
| `ACTIVATION_KEY` | `""` | rhel only: the activation key for Red Hat Subscription Management (RHSM) |

e.g. to produce an s390x architecture builder image

```
ARCH=s390x make -C .. podvm-builder
```
Expand All @@ -75,7 +79,7 @@ Like the builder image, we have make targets for the binaries image in the paren
To build the binaries image, use the following command:

```bash
$ BUILDER_IMG=<your_builder_image> make -C .. podvm-binaries
BUILDER_IMG=<your_builder_image> make -C .. podvm-binaries
```

The build process can take significant time.
Expand Down Expand Up @@ -113,9 +117,11 @@ use the QEMU builder in emulation mode when running within container.
> **Note:** Beware that the process consume a bunch of memory and disk from the host.
If the build fails at the point QEMU was launched but packer couldn't
connect via ssh, with an error similar to:
>
> ```
> Build 'qemu.ubuntu' errored after 5 minutes 57 seconds: Timeout waiting for SSH.
> ```
>
> then it might indicate lack of memory, so try to increase the amount of memory if running on VM.
The podvm image can be built for other architectures than `x86_64` by passing
Expand All @@ -130,14 +136,17 @@ $ docker build -t podvm_s390x \
```
The Secure Execution enabled podvm image can be built by passing the `SE_BOOT` build argument to docker. Currently this is only supported for Ubutu `s390x`, which also needs put the `HOST KEY documents` to the [files](files) folder, please follow the `Download host key document from Resource Link` section at [this document](../ibmcloud/SECURE_EXECUTION.md) to download `HOST KEY documents`.

```bash
$ tree -L 1 files
files
├── HKD-8562-1234567.crt
├── etc
└── usr
```

Running below command will build the Secure Execution enabled qcow2 image:

```bash
$ docker build -t se_podvm_s390x \
--build-arg ARCH=s390x \
Expand Down Expand Up @@ -174,12 +183,13 @@ file out of the podvm container image.
Running the below command will extract the qcow2 image built in the previous step.

```bash
$ ./hack/download-image.sh podvm:latest . -o podvm.qcow2
./hack/download-image.sh podvm:latest . -o podvm.qcow2
```

Running the below command will extract the Secure Execution enabled qcow2 image built in the previous step.

```bash
$ ./hack/download-image.sh se_podvm_s390x:latest . -o se_podvm.qcow2
./hack/download-image.sh se_podvm_s390x:latest . -o se_podvm.qcow2
```

# How to add support for a new Linux distribution
Expand All @@ -189,7 +199,7 @@ In order to add a new Linux distribution essentially it is needed to create some
Follow the steps below, replacing `DISTRO` with the name of the distribution being added:

1. Create the builder dockerfile by copying `Dockerfile.podvm_builder` to `Dockerfile.podvm_builder.DISTRO` and
adjusting the file properly (e.g. replace `FROM ubuntu:20.04` with `FROM DISTRO`). Try to keep the same
adjusting the file properly (e.g. replace `FROM ubuntu:24.04` with `FROM DISTRO`). Try to keep the same
software versions (e.g. Golang) as much as possible.
2. Create the podvm image dockerfile by copying `Dockerfile.podvm` to `Dockerfile.podvm.DISTRO` and adjusting the file
properly likewise. In particular, the *PODVM_DISTRO* and *BUILDER_IMG* arguments should be changed.
Expand Down

0 comments on commit 14e6d35

Please sign in to comment.