Skip to content

Instantly share code, notes, and snippets.

@tormath1
Last active October 16, 2023 07:52
Show Gist options
  • Save tormath1/acbae5c6cd12420bb8ea137e25655c99 to your computer and use it in GitHub Desktop.
Save tormath1/acbae5c6cd12420bb8ea137e25655c99 to your computer and use it in GitHub Desktop.
CAPO CI Flatcar update

CAPO does test in its CI both Ubuntu and Flatcar. For Flatcar, the image still needs to be built via the image-builder and uploaded on CAPO GCS (Google Cloud Storage).

There is an open issue to bring some automation around this process: kubernetes-sigs/cluster-api-provider-openstack#1502 while it is not done, whether CAPO or Flatcar maintainers needs to do it manually.

  1. Once the release is announced
$ cd kubernetes-sigs/image-builder/images/capi
$ make OEM_ID=openstack build-qemu-flatcar

NOTE: It is possible to use the Docker image, but it takes a hack which is not yet merged so you need to build the image:

diff --git a/images/capi/Dockerfile b/images/capi/Dockerfile
index 9514c03ae..372b8dfc2 100644
--- a/images/capi/Dockerfile
+++ b/images/capi/Dockerfile
@@ -38,18 +38,15 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
 ARG ARCH
 ARG PASSED_IB_VERSION

-USER imagebuilder
-WORKDIR /home/imagebuilder/
-
-COPY --chown=imagebuilder:imagebuilder ansible ansible/
-COPY --chown=imagebuilder:imagebuilder ansible.cfg ansible.cfg
-COPY --chown=imagebuilder:imagebuilder cloudinit cloudinit/
-COPY --chown=imagebuilder:imagebuilder hack hack/
-COPY --chown=imagebuilder:imagebuilder packer packer/
-COPY --chown=imagebuilder:imagebuilder Makefile Makefile
-COPY --chown=imagebuilder:imagebuilder azure_targets.sh azure_targets.sh
-
-ENV PATH="/home/imagebuilder/.local/bin:${PATH}"
+COPY ansible ansible/
+COPY ansible.cfg ansible.cfg
+COPY cloudinit cloudinit/
+COPY hack hack/
+COPY packer packer/
+COPY Makefile Makefile
+COPY azure_targets.sh azure_targets.sh
+
+ENV PATH="/root/.local/bin:${PATH}"
 ENV PACKER_ARGS ''
 ENV PACKER_VAR_FILES ''
 ENV IB_VERSION "${PASSED_IB_VERSION}"

Then:

sudo podman run -it --privileged -v "${PWD}/docker-output:/output" -v /dev:/dev --net host --rm -e PACKER_LOG=1 -e OEM_ID=openstack -e PACKER_FLAGS="--var 'kubernetes_semver=v1.27.2' --var 'kubernetes_series=v1.27'" image-builder build-qemu-flatcar
  1. Upload the built image to GCS. NOTE: If you are a CAPO maintainer, you can directly upload it to the CAPO GCS, if not you can ask a maintainer to upload it in the PR
  2. Bump the version in ./hack/ci/cloud-init/controller.yaml.tpl and in the e2e conf

You can use this example as inspiration: kubernetes-sigs/cluster-api-provider-openstack#1524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment