Problem Statement
The current golden container disk image build (build/golden-image/Containerfile) uses FROM quay.io/containerdisks/fedora:41 and runs RUN dnf install to pre-install workload packages. This fails because KubeVirt containerdisk images are minimal OCI wrappers around a qcow2 disk image — they do not have a regular root filesystem with a package manager.
Developers cannot build the golden image, and there is no declarative way to manage the package list for the image.
Proposed Solution
Replace the Containerfile-based build with an osbuild workflow using the image-builder CLI and a TOML blueprint.
Workflow:
- A
blueprint.toml file declaratively lists all packages to install (stress-ng, fio, iperf3, postgresql-server, iproute-tc, iptables-nft, kernel-modules-extra, netperf, python3, cloud-init, qemu-guest-agent).
image-builder build qcow2 --distro fedora-41 --blueprint blueprint.toml produces a real Fedora 41 qcow2 disk image with all packages baked in.
- A minimal
FROM scratch Containerfile packages the qcow2 into a KubeVirt-compatible containerdisk OCI image.
Files to change (all under build/golden-image/):
- Create
blueprint.toml — osbuild TOML blueprint with all workload packages
- Rewrite
build.sh — two-stage build: image-builder build then podman build
- Rewrite
Containerfile — minimal FROM scratch + COPY qcow2 /disk/
- Rewrite
README.md — document prerequisites, workflow, and how to add packages
Benefits:
- Declarative, version-controlled package manifest (edit TOML to add packages)
- osbuild validates packages exist at build time — fast failure on typos or missing packages
- No daemon required (
image-builder CLI runs standalone, unlike osbuild-composer)
- Developers have a clear pathway to add packages for custom workloads
- Aligns with Fedora/Red Hat image-based Linux tooling direction
Prerequisites for builders:
image-builder package (dnf install image-builder on Fedora)
podman (already required)
Alternatives Considered
-
virt-customize — Download the Fedora Cloud qcow2, run virt-customize --install ..., package as containerdisk. Simpler but imperative (shell script, not declarative). No structured way for developers to manage the package list. Requires libguestfs-tools.
-
bootc (boot containers) — Build a bootc container image with packages, convert to qcow2 via bootc-image-builder, package as containerdisk. Works but: requires bootc-image-builder as an extra dependency, produces ostree-based images (larger, read-only rootfs adds complexity), and the two-stage build is more complex than osbuild.
Additional Context
- The
image-builder package (v65) is available in Fedora repos and wraps osbuild without requiring a daemon.
- The
qcow2 image type from osbuild for Fedora includes cloud-init, qemu-guest-agent, chrony, and kernel by default.
- The existing env var interface (
REGISTRY, IMAGE_NAME, TAG, PUSH) and usage patterns (CLI flag --container-disk-image, env var VIRTWORK_CONTAINER_DISK_IMAGE, config key container_disk_image) remain unchanged.
- Blueprint reference: https://osbuild.org/docs/user-guide/blueprint-reference/
- CLI docs: https://osbuild.org/docs/on-premises/commandline/
Problem Statement
The current golden container disk image build (
build/golden-image/Containerfile) usesFROM quay.io/containerdisks/fedora:41and runsRUN dnf installto pre-install workload packages. This fails because KubeVirt containerdisk images are minimal OCI wrappers around a qcow2 disk image — they do not have a regular root filesystem with a package manager.Developers cannot build the golden image, and there is no declarative way to manage the package list for the image.
Proposed Solution
Replace the Containerfile-based build with an osbuild workflow using the
image-builderCLI and a TOML blueprint.Workflow:
blueprint.tomlfile declaratively lists all packages to install (stress-ng, fio, iperf3, postgresql-server, iproute-tc, iptables-nft, kernel-modules-extra, netperf, python3, cloud-init, qemu-guest-agent).image-builder build qcow2 --distro fedora-41 --blueprint blueprint.tomlproduces a real Fedora 41 qcow2 disk image with all packages baked in.FROM scratchContainerfile packages the qcow2 into a KubeVirt-compatible containerdisk OCI image.Files to change (all under
build/golden-image/):blueprint.toml— osbuild TOML blueprint with all workload packagesbuild.sh— two-stage build:image-builder buildthenpodman buildContainerfile— minimalFROM scratch+COPY qcow2 /disk/README.md— document prerequisites, workflow, and how to add packagesBenefits:
image-builderCLI runs standalone, unlikeosbuild-composer)Prerequisites for builders:
image-builderpackage (dnf install image-builderon Fedora)podman(already required)Alternatives Considered
virt-customize— Download the Fedora Cloud qcow2, runvirt-customize --install ..., package as containerdisk. Simpler but imperative (shell script, not declarative). No structured way for developers to manage the package list. Requireslibguestfs-tools.bootc (boot containers) — Build a bootc container image with packages, convert to qcow2 via
bootc-image-builder, package as containerdisk. Works but: requiresbootc-image-builderas an extra dependency, produces ostree-based images (larger, read-only rootfs adds complexity), and the two-stage build is more complex than osbuild.Additional Context
image-builderpackage (v65) is available in Fedora repos and wrapsosbuildwithout requiring a daemon.qcow2image type from osbuild for Fedora includes cloud-init, qemu-guest-agent, chrony, and kernel by default.REGISTRY,IMAGE_NAME,TAG,PUSH) and usage patterns (CLI flag--container-disk-image, env varVIRTWORK_CONTAINER_DISK_IMAGE, config keycontainer_disk_image) remain unchanged.