From f18dbc7d3c82d852259fa3c12f75479fe74858d3 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 4 Jun 2024 15:45:49 +0100 Subject: [PATCH] Add Ubuntu 24.02 for QEMU --- images/capi/Makefile | 4 +- .../qemu/linux/ubuntu/http/24.04/meta-data | 0 .../qemu/linux/ubuntu/http/24.04/user-data | 93 +++++++++++++++++++ images/capi/packer/qemu/qemu-ubuntu-2404.json | 13 +++ 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 images/capi/packer/qemu/linux/ubuntu/http/24.04/meta-data create mode 100644 images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data create mode 100644 images/capi/packer/qemu/qemu-ubuntu-2404.json diff --git a/images/capi/Makefile b/images/capi/Makefile index eacfd520f3..53489c9f4a 100644 --- a/images/capi/Makefile +++ b/images/capi/Makefile @@ -370,7 +370,7 @@ OPENSTACK_BUILD_NAMES ?= openstack-ubuntu-2004 openstack-ubuntu-2204 openstack- OSC_BUILD_NAMES ?= osc-ubuntu-2004 osc-ubuntu-2204 -QEMU_BUILD_NAMES ?= qemu-ubuntu-2004 qemu-ubuntu-2204 qemu-ubuntu-2204-cloudimg qemu-ubuntu-2304 qemu-ubuntu-2204-efi qemu-centos-7 qemu-centos-9 qemu-ubuntu-2004-efi qemu-rhel-8 qemu-rhel-9 qemu-rockylinux-8 qemu-rockylinux-8-cloudimg qemu-rockylinux-9 qemu-rockylinux-9-cloudimg qemu-flatcar +QEMU_BUILD_NAMES ?= qemu-ubuntu-2004 qemu-ubuntu-2204 qemu-ubuntu-2204-cloudimg qemu-ubuntu-2304 qemu-ubuntu-2404 qemu-ubuntu-2204-efi qemu-centos-7 qemu-centos-9 qemu-ubuntu-2004-efi qemu-rhel-8 qemu-rhel-9 qemu-rockylinux-8 qemu-rockylinux-8-cloudimg qemu-rockylinux-9 qemu-rockylinux-9-cloudimg qemu-flatcar QEMU_KUBEVIRT_BUILD_NAMES := $(addprefix kubevirt-,$(QEMU_BUILD_NAMES)) @@ -796,6 +796,7 @@ build-qemu-ubuntu-2204: ## Builds Ubuntu 22.04 QEMU image build-qemu-ubuntu-2204-cloudimg: ## Builds Ubuntu 22.04 QEMU image using cloud image build-qemu-ubuntu-2204-efi: ## Builds Ubuntu 22.04 QEMU image that EFI boots build-qemu-ubuntu-2304: ## Builds Ubuntu 23.04 QEMU image +build-qemu-ubuntu-2404: ## Builds Ubuntu 24.04 QEMU image build-qemu-centos-7: ## Builds CentOS 7 QEMU image build-qemu-centos-9: ## Builds CentOS 9 Stream QEMU image build-qemu-rhel-8: ## Builds RHEL 8 QEMU image @@ -966,6 +967,7 @@ validate-qemu-ubuntu-2204: ## Validates Ubuntu 22.04 QEMU image packer config validate-qemu-ubuntu-2204-cloudimg: ## Validates Ubuntu 22.04 QEMU image packer config using cloud image validate-qemu-ubuntu-2204-efi: ## Validates Ubuntu 22.04 QEMU EFI image packer config validate-qemu-ubuntu-2304: ## Validates Ubuntu 23.04 QEMU image packer config +validate-qemu-ubuntu-2404: ## Validates Ubuntu 24.04 QEMU image packer config validate-qemu-centos-7: ## Validates CentOS 7 QEMU image packer config validate-qemu-rhel-8: ## Validates RHEL 8 QEMU image validate-qemu-rhel-9: ## Validates RHEL 9 QEMU image diff --git a/images/capi/packer/qemu/linux/ubuntu/http/24.04/meta-data b/images/capi/packer/qemu/linux/ubuntu/http/24.04/meta-data new file mode 100644 index 0000000000..e69de29bb2 diff --git a/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data b/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data new file mode 100644 index 0000000000..e6b1fc77a3 --- /dev/null +++ b/images/capi/packer/qemu/linux/ubuntu/http/24.04/user-data @@ -0,0 +1,93 @@ +#cloud-config +# Copyright 2022 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# For more information on how autoinstall is configured, please refer to +# https://ubuntu.com/server/docs/install/autoinstall-reference +autoinstall: + version: 1 + # Disable ssh server during installation, otherwise packer tries to connect and exceed max attempts + early-commands: + - systemctl stop ssh + # Configure the locale + locale: en_US.UTF-8 + keyboard: + layout: us + apt: + mirror-selection: + primary: + - uri: http://archive.ubuntu.com/ubuntu + # Create a single-partition with no swap space. Kubernetes + # really dislikes the idea of anyone else managing memory. + # For more information on how partitioning is configured, + # please refer to https://curtin.readthedocs.io/en/latest/topics/storage.html. + storage: + grub: + replace_linux_default: false + config: + - type: disk + id: disk-0 + size: largest + grub_device: true + preserve: false + ptable: msdos + wipe: superblock + - type: partition + id: partition-0 + device: disk-0 + size: -1 + number: 1 + preserve: false + flag: boot + - type: format + id: format-0 + volume: partition-0 + fstype: ext4 + preserve: false + - type: mount + id: mount-0 + device: format-0 + path: / + updates: 'all' + ssh: + install-server: true + allow-pw: true + # Customize the list of packages installed. + packages: + - open-vm-tools + # Create the default user. + # Ensures the "builder" user doesn't require a password to use sudo. + user-data: + users: + - name: builder + # openssl passwd -6 -stdin <<< builder + passwd: $6$xyz$UtXVazU08Q5b8AW.TJ3MPYZglyXa3Ttf2RCel8MCUPlEYO1evWxeWBhZ2QqivU/Ij4tqYAxMCqc2ujEM4dMSe1 + groups: [adm, cdrom, dip, plugdev, lxd, sudo] + lock-passwd: false + sudo: ALL=(ALL) NOPASSWD:ALL + shell: /bin/bash + + # This command runs after all other steps; it: + # 1. Disables swapfiles + # 2. Removes the existing swapfile + # 3. Removes the swapfile entry from /etc/fstab + # 4. Cleans up any packages that are no longer required + # 5. Removes the cached list of packages + late-commands: + - swapoff -a + - rm -f /swapfile + - sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - apt-get purge --auto-remove -y + - rm -rf /var/lib/apt/lists/* diff --git a/images/capi/packer/qemu/qemu-ubuntu-2404.json b/images/capi/packer/qemu/qemu-ubuntu-2404.json new file mode 100644 index 0000000000..673daa8852 --- /dev/null +++ b/images/capi/packer/qemu/qemu-ubuntu-2404.json @@ -0,0 +1,13 @@ +{ + "boot_command_prefix": "clinux /casper/vmlinuz --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/24.04/'initrd /casper/initrdboot", + "build_name": "ubuntu-2404", + "distribution_version": "2404", + "distro_name": "ubuntu", + "guest_os_type": "ubuntu-64", + "iso_checksum": "8762f7e74e4d64d72fceb5f70682e6b069932deedb4949c6975d0f0fe0a91be3", + "iso_checksum_type": "sha256", + "iso_url": "https://releases.ubuntu.com/releases/24.04/ubuntu-24.04-live-server-amd64.iso", + "os_display_name": "Ubuntu 24.04", + "shutdown_command": "shutdown -P now", + "unmount_iso": "true" +}