Skip to content

Commit

Permalink
doc: Update podvm_builder doc
Browse files Browse the repository at this point in the history
Similar to #1990, update the podvm_builder documentation
to use the `make` command, rather than the docker file directly
to hide the complexity and allow the versions to be picked
up automatically

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
  • Loading branch information
stevenhorsman committed Aug 15, 2024
1 parent 8de633b commit 53b8ff2
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions src/cloud-api-adaptor/podvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,27 @@ The builder image packages the cloud-api-adaptor and Kata Containers sources as
the binaries (e.g. *kata-agent* and *agent-protocol-forwarder*) that should be installed in the podvm image.

The builder image is agnostic to cloud providers in the sense that one can be used to build for multiple providers, however it is
dependent on the Linux distribution the image is built for. Therefore, in this directory you will find dockerfiles for each supported distributions, which are currently Ubuntu 20.04 ([Dockerfile.podvm_builder](./Dockerfile.podvm_builder)), and RHEL 9 ([Dockerfile.podvm_builder.rhel](./Dockerfile.podvm_builder.rhel)).

As an example, to build the builder image for Ubuntu, run:
dependent on the Linux distribution the image is built for. Therefore, in this directory you will find dockerfiles for each
supported distributions, which are currently Ubuntu 20.04 ([Dockerfile.podvm_builder](./Dockerfile.podvm_builder)),
Fedora 39 ([Dockerfile.podvm_builder.fedora](./Dockerfile.podvm_builder)) and RHEL 9
([Dockerfile.podvm_builder.rhel](./Dockerfile.podvm_builder.rhel)).

You can create the builder image using the make target under the `src/cloud-api-adaptor` folder by running:
```bash
$ docker build -t podvm_builder \
-f Dockerfile.podvm_builder .
$ make podvm-builder
```

Use `--build-arg` to pass build arguments to docker to overwrite default values if needed. Following are the arguments
currently accepted:

| Argument | Default value | Description |
| ----------------- | ------------------------------------------------------------ | --------------------------------------------------------------- |
| GO\_VERSION | 1.21.12 | Go version |
| PROTOC\_VERSION | 3.15.0 | [Protobuf](https://github.com/protocolbuffers/protobuf) version |
| RUST\_VERSION | 1.75.0 | Rust version |
| YQ\_VERSION | v4.35.1 | [yq](https://github.com/mikefarah/yq/) version |

As it can be noted in the table above the cloud-api-adaptor repository is cloned within the builder image, so rather than
copying the local source tree, it will be using the upstream source. But if you want to test local changes then you should:
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 |
| `PODVM_DISTRO` | `ubuntu` | Valid options are `ubuntu`, `fedora` and `rhel` |
| `ORG_ID` | `""` | rhel only: the organization ID for Red Hat Subscription Management (RHSM) |
| `ACTIVATION_KEY` | `""` | rhel only: the activation key for Red Hat Subscription Management (RHSM) |

* Push the changes to your fork in github (e.g. https://github.com/$USER/cloud-api-adaptor/tree/my-changes-in-a-branch).
* Overwrite the *CAA_SRC* and *CAA_SRC_REF* arguments as shown below:

```bash
$ docker build -t podvm_builder \
--build-arg CAA_SRC=https://github.com/$USER/cloud-api-adaptor \
--build-arg CAA_SRC_REF=my-changes-in-a-branch \
-f Dockerfile.podvm_builder .
e.g. to produce an s390x architecture builder image
```
ARCH=s390x make podvm-builder
```
## Building the image containing the podvm binaries
Expand Down

0 comments on commit 53b8ff2

Please sign in to comment.