gyptazy

DevOps

Developer

IT Consultant

gyptazy

DevOps

Developer

IT Consultant

Blog Post

Garden Linux comes with Firecracker (microVM) images

Garden Linux comes with Firecracker (microVM) images

Now, Garden Linux comes with Firecracker (microVM) images for running heavy workloads. You may also find some more information on Firecracker within my last post.
Thanks to nkraetzschmar for adding Firecracker support within the Garden Linux feature system. Next to this, the Pytest pipeline needed further adjustments as well as a new IAAS type to perform tests on microVMs. With my PR feat(pytest): Add Firecracker IAAS for PyTest #1318 I recently added further support for Firecracker images as a new IAAS platform type. The new IAAS takes care for all image and network related adjustments to fit the Pytest’s RemoteClient object requirements.

Creating a Garden Linux Firecracker image
Creating a Firecracker image is as easy as building regular images and can simply be accomplished by running:

# Production image
make firecracker
# Dev image (autologin, etc.)
make firecracker-dev

This creates the kernel- & filesystem image artifacts:
* kernel image: firecracker_dev-amd64-today-0ee7682b.vmlinux
* filesystem image: firecracker_dev-amd64-today-0ee7682b.ext4

Run Pytest on Garden Linux Firecracker image
Afterwards, the regular Pytest can be performed (see also: Garden Linux Pytest docs). Make sure to have /dev/kvm present and accessible and create a simple firecracker IAAS configuration (all options can be found here):

# firecracker.yaml
firecracker:
    # Path to a final artifacts. This includes the Kernel
    # and a filesystem image
    kernel: /gardenlinux/.build/firecracker_dev-amd64-today-0ee7682b.vmlinux
    image: /gardenlinux/.build/firecracker_dev-amd64-today-0ee7682b.ext4
    readonly: False
    # Filesystem mount path to mount filesystem image for further
    # inlcudes and adjustments (optioanl)
    # Default: tmpdir
    image_mount: /tmp/image_mount

    # List of features that is used to determine the tests to run
    features:
      - "base"

    # SSH configuration (required)
    ssh:
        # Defines if a new SSH key should be generated (optional)
        # Default: true
        ssh_key_generate: true

        # Defines path where to look for a given key
        # or to save the new generated one. Take care
        # that you do NOT overwrite your key. (required)
        ssh_key_filepath: /tmp/ssh_priv_key

        # Defines the user for SSH login (required)
        # Default: root
        user: root

Next, just start the integration-test container and run Pytest:

# Start container
sudo podman run -it --rm --privileged -v `pwd`:/gardenlinux gardenlinux/integration-test:`bin/garden-version` bash

# Run Pytest
pytest --iaas=firecracker --configfile=myfirecrackerconfig.yaml

Glad to have the tests for Firecracker images covered, now.

Taggs: