Skip to content

Commit

Permalink
Merge pull request #1459 from sriramandev/topic/ssriraman/suport-ubun…
Browse files Browse the repository at this point in the history
…tu-2404

Add Ubuntu 24.04 LTS for VMware vSphere
  • Loading branch information
k8s-ci-robot authored Jul 30, 2024
2 parents fd21671 + 54d1f5c commit a662bf4
Show file tree
Hide file tree
Showing 17 changed files with 318 additions and 14 deletions.
5 changes: 4 additions & 1 deletion docs/book/src/capi/providers/vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ In addition to the configuration found in `images/capi/packer/config`, the `ova`
| `rhel-7.json` | The settings for the RHEL 7 image |
| `ubuntu-1804.json` | The settings for the Ubuntu 18.04 image |
| `ubuntu-2004.json` | The settings for the Ubuntu 20.04 image |
| `ubuntu-2204.json` | The settings for the Ubuntu 22.04 image |
| `ubuntu-2204.json` | The settings for the Ubuntu 22.04 image |
| `ubuntu-2204-efi.json` | The settings for the Ubuntu 22.04 EFI image |
| `ubuntu-2404.json` | The settings for the Ubuntu 24.04 image |
| `ubuntu-2404-efi.json` | The settings for the Ubuntu 24.04 EFI image |
| `vsphere.json` | Additional settings needed when building on a remote vSphere |

### Photon specific options
Expand Down
8 changes: 5 additions & 3 deletions images/capi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
wget \
qemu-system-x86 \
qemu-kvm \
&& useradd -ms /bin/bash imagebuilder \
&& apt-get purge --auto-remove -y \
&& rm -rf /var/lib/apt/lists/*
# Adding xorriso to create iso for mounting cd_drives which then can be used for bootstrapping node image
xorriso \
&& useradd -ms /bin/bash imagebuilder \
&& apt-get purge --auto-remove -y \
&& rm -rf /var/lib/apt/lists/*

ARG ARCH
ARG PASSED_IB_VERSION
Expand Down
11 changes: 10 additions & 1 deletion images/capi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ FLATCAR_VERSIONS := flatcar
PHOTON_VERSIONS := photon-3 photon-4 photon-5
RHEL_VERSIONS := rhel-7 rhel-8 rhel-9
ROCKYLINUX_VERSIONS := rockylinux-8 rockylinux-9
UBUNTU_VERSIONS := ubuntu-2004 ubuntu-2004-efi ubuntu-2204 ubuntu-2204-efi
UBUNTU_VERSIONS := ubuntu-2004 ubuntu-2004-efi ubuntu-2204 ubuntu-2204-efi ubuntu-2404 ubuntu-2404-efi
WINDOWS_VERSIONS := windows-2019 windows-2019-efi windows-2022 windows-2022-efi

# Set Flatcar Container Linux channel and version if not supplied
Expand Down Expand Up @@ -716,6 +716,8 @@ build-node-ova-vsphere-ubuntu-2004: ## Builds Ubuntu 20.04 Node OVA and template
build-node-ova-vsphere-ubuntu-2004-efi: ## Builds Ubuntu 20.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-ubuntu-2204: ## Builds Ubuntu 22.04 Node OVA and template on vSphere
build-node-ova-vsphere-ubuntu-2204-efi: ## Builds Ubuntu 22.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-ubuntu-2404: ## Builds Ubuntu 24.04 Node OVA and template on vSphere
build-node-ova-vsphere-ubuntu-2404-efi: ## Builds Ubuntu 24.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-windows-2019: ## Builds for Windows Server 2019 and template on vSphere
build-node-ova-vsphere-windows-2019-efi: ## Builds for Windows Server 2019 and template on vSphere that EFI boots
build-node-ova-vsphere-windows-2022: ## Builds for Windows Server 2022 template on vSphere
Expand All @@ -734,6 +736,8 @@ build-node-ova-vsphere-clone-rockylinux-9: ## Builds RockyLinux 9 Node OVA and t
build-node-ova-vsphere-clone-ubuntu-2004: ## Builds Ubuntu 20.04 Node OVA and template on vSphere
build-node-ova-vsphere-clone-ubuntu-2204: ## Builds Ubuntu 22.04 Node OVA and template on vSphere
build-node-ova-vsphere-clone-ubuntu-2204-efi: ## ## Builds Ubuntu 22.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-clone-ubuntu-2404: ## Builds Ubuntu 24.04 Node OVA and template on vSphere
build-node-ova-vsphere-clone-ubuntu-2404-efi: ## ## Builds Ubuntu 24.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-clone-all: $(NODE_OVA_VSPHERE_CLONE_BUILD_TARGETS) ## Builds all Node OVAs and templates on vSphere

build-node-ova-vsphere-base-centos-7: ## Builds base CentOS 7 Node OVA and template on vSphere
Expand All @@ -748,6 +752,8 @@ build-node-ova-vsphere-base-rockylinux-9: ## Builds base RockyLinux 9 Node OVA a
build-node-ova-vsphere-base-ubuntu-2004: ## Builds base Ubuntu 20.04 Node OVA and template on vSphere
build-node-ova-vsphere-base-ubuntu-2204: ## Builds base Ubuntu 22.04 Node OVA and template on vSphere
build-node-ova-vsphere-base-ubuntu-2204-efi: ## Builds Ubuntu 22.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-base-ubuntu-2404: ## Builds base Ubuntu 24.04 Node OVA and template on vSphere
build-node-ova-vsphere-base-ubuntu-2404-efi: ## Builds Ubuntu 24.04 Node OVA and template on vSphere that EFI boots
build-node-ova-vsphere-base-all: $(NODE_OVA_VSPHERE_BASE_BUILD_TARGETS) ## Builds all base Node OVAs and templates on vSphere

build-node-ova-local-vmx-photon-3: ## Builds Photon 3 Node OVA from VMX file w local hypervisor
Expand Down Expand Up @@ -922,6 +928,7 @@ validate-node-ova-local-rockylinux-8: ## Validates RockyLinux 8 Node OVA Packer
validate-node-ova-local-rockylinux-9: ## Validates RockyLinux 9 Node OVA Packer config w local hypervisor
validate-node-ova-local-ubuntu-2004: ## Validates Ubuntu 20.04 Node OVA Packer config w local hypervisor
validate-node-ova-local-ubuntu-2204: ## Validates Ubuntu 22.04 Node OVA Packer config w local hypervisor
validate-node-ova-local-ubuntu-2404: ## Validates Ubuntu 24.04 Node OVA Packer config w local hypervisor
validate-node-ova-local-windows-2019: ## Validates Windows Server 2019 Node OVA Packer config w local hypervisor
validate-node-ova-local-windows-2022: ## Validates Windows Server 2022 Node OVA Packer config w local hypervisor
validate-node-ova-local-all: $(NODE_OVA_LOCAL_VALIDATE_TARGETS) ## Validates all Node OVAs Packer config w local hypervisor
Expand All @@ -937,6 +944,7 @@ validate-node-ova-local-vmx-rockylinux-8: ## Validates RockyLinux 8 Node OVA fro
validate-node-ova-local-vmx-rockylinux-9: ## Validates RockyLinux 9 Node OVA from VMX file w local hypervisor
validate-node-ova-local-vmx-ubuntu-2004: ## Validates Ubuntu 20.04 Node OVA from VMX file w local hypervisor
validate-node-ova-local-vmx-ubuntu-2204: ## Validates Ubuntu 22.04 Node OVA from VMX file w local hypervisor
validate-node-ova-local-vmx-ubuntu-2404: ## Validates Ubuntu 24.04 Node OVA from VMX file w local hypervisor

validate-node-ova-local-base-photon-3: ## Validates Photon 3 Base Node OVA w local hypervisor
validate-node-ova-local-base-photon-4: ## Validates Photon 4 Base Node OVA w local hypervisor
Expand All @@ -949,6 +957,7 @@ validate-node-ova-local-base-rockylinux-8: ## Validates RockyLinux 8 Base Node O
validate-node-ova-local-base-rockylinux-9: ## Validates RockyLinux 9 Base Node OVA w local hypervisor
validate-node-ova-local-base-ubuntu-2004: ## Validates Ubuntu 20.04 Base Node OVA w local hypervisor
validate-node-ova-local-base-ubuntu-2204: ## Validates Ubuntu 22.04 Base Node OVA w local hypervisor
validate-node-ova-local-base-ubuntu-2404: ## Validates Ubuntu 24.04 Base Node OVA w local hypervisor

validate-qemu-flatcar: ## Validates Flatcar QEMU image packer config
validate-qemu-ubuntu-2004: ## Validates Ubuntu 20.04 QEMU image packer config
Expand Down
11 changes: 11 additions & 0 deletions images/capi/ansible/roles/providers/tasks/vmware-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
name: hv-kvp-daemon
state: stopped
enabled: false
register: disable_hypervisor
ignore_errors: true
failed_when:
- disable_hypervisor.failed
- '"Could not find" not in disable_hypervisor.msg'

- name: Ensure networkd-dispatcher is enabled and running
ansible.builtin.systemd:
name: networkd-dispatcher
state: started
enabled: true

- name: Copy networkd-dispatcher scripts to add DHCP provided NTP servers
ansible.builtin.template:
Expand Down
13 changes: 12 additions & 1 deletion images/capi/ansible/roles/setup/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@
mode: "0644"
# OCI Base images have the required apt sources list embedded inside the image, adding the sources list
# from this repo leads to build failures(especially in Arm), hence ignoring the step.
when: packer_builder_type != "oracle-oci"
# Ubuntu 24.04 has changed to deb822 source management
# As a result the there is change in format source configurations and location
when: (packer_builder_type != "oracle-oci") and ((ansible_distribution == "Ubuntu") and (ansible_distribution_major_version is version('24', '<')))

- name: Put templated ubuntu.sources in place
ansible.builtin.template:
src: etc/apt/sources.list.d/ubuntu.sources.j2
dest: /etc/apt/sources.list.d/ubuntu.sources
mode: "0644"
# Ubuntu 24.04 has changed to deb822 source management
# As a result the there is change in format source configurations and location
when: (ansible_distribution == "Ubuntu") and (ansible_distribution_major_version is version('24', '>='))

- name: Put templated apt.conf.d/90proxy in place when defined
ansible.builtin.template:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Types: deb
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: {{ ansible_distribution_release }} {{ ansible_distribution_release }}-updates {{ ansible_distribution_release }}-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: {{ ansible_distribution_release }}-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Empty file.
114 changes: 114 additions & 0 deletions images/capi/packer/ova/linux/ubuntu/http/24.04.efi/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#cloud-config
# Copyright 2024 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
# For more information on how partitioning is configured,
# please refer to https://curtin.readthedocs.io/en/latest/topics/storage.html.
storage:
swap:
size: 0
grub:
reorder_uefi: false
replace_linux_default: false
config:
- ptable: gpt
path: /dev/sda
wipe: superblock-recursive
preserve: false
name: ''
grub_device: false
type: disk
id: disk-sda
- device: disk-sda
# Create EFI partition of 512MB same as in Ubuntu 20.04
size: 536870912
wipe: superblock
flag: boot
number: 1
preserve: false
grub_device: true
type: partition
id: partition-0
- fstype: fat32
volume: partition-0
preserve: false
type: format
id: format-0
- device: disk-sda
size: -1
wipe: superblock
flag: ''
number: 2
preserve: false
grub_device: false
type: partition
id: partition-1
- fstype: ext4
volume: partition-1
preserve: false
type: format
id: format-1
- path: /
device: format-1
type: mount
id: mount-1
- path: /boot/efi
device: format-0
type: mount
id: mount-0
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. Removes snapd, https://bugs.launchpad.net/subiquity/+bug/1946609
# 5. Cleans up any packages that are no longer required
# 6. Removes the cached list of packages
late-commands:
- curtin in-target --target=/target -- swapoff -a
- curtin in-target --target=/target -- rm -f /swap.img
- curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
- chroot /target apt-get purge -y snapd
- curtin in-target --target=/target -- apt-get purge --auto-remove -y
- curtin in-target --target=/target -- apt-get clean
- curtin in-target --target=/target -- rm -rf /var/lib/apt/lists/*
Empty file.
94 changes: 94 additions & 0 deletions images/capi/packer/ova/linux/ubuntu/http/24.04/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#cloud-config
# Copyright 2024 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
# 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:
swap:
size: 0
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. Removes snapd, https://bugs.launchpad.net/subiquity/+bug/1946609
# 5. Cleans up any packages that are no longer required
# 6. Removes the cached list of packages
late-commands:
- curtin in-target --target=/target -- swapoff -a
- curtin in-target --target=/target -- rm -f /swap.img
- curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
- chroot /target apt-get purge -y snapd
- curtin in-target --target=/target -- apt-get purge --auto-remove -y
- curtin in-target --target=/target -- apt-get clean
- curtin in-target --target=/target -- rm -rf /var/lib/apt/lists/*
4 changes: 4 additions & 0 deletions images/capi/packer/ova/packer-node.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@
"{{user `boot_command_suffix`}}"
],
"boot_wait": "{{user `boot_wait`}}",
"cd_files": "{{user `cd_content_location`}}",
"cd_label": "{{user `cd_label`}}",
"cdrom_type": "{{user `cdrom_type`}}",
"cluster": "{{user `cluster`}}",
"communicator": "ssh",
Expand Down Expand Up @@ -469,6 +471,8 @@
"block_nouveau_loading": "true",
"build_timestamp": "{{timestamp}}",
"build_version": "{{user `build_name`}}-kube-{{user `kubernetes_semver`}}",
"cd_files": "{{user `cd_content_location`}}",
"cd_label": "{{user `cd_label`}}",
"cdrom_adapter_type": "ide",
"cdrom_type": "ide",
"cluster": "",
Expand Down
6 changes: 4 additions & 2 deletions images/capi/packer/ova/photon-5.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"boot_command_prefix": "<esc><wait> vmlinuz initrd=initrd.img root/dev/ram0 loglevel=3 photon.media=cdrom ks=",
"boot_command_suffix": "/5/ks.json insecure_installation=1<enter><wait>",
"boot_media_path": "http://{{ .HTTPIP }}:{{ .HTTPPort }}",
"boot_command_suffix": " insecure_installation=1<enter><wait>",
"boot_media_path": "/dev/sr1:/5/ks.json",
"build_name": "photon-5",
"cd_content_location": "./packer/ova/linux/{{user `distro_name`}}/http/*",
"cd_label": "cidata",
"cdrom_type": "sata",
"distro_arch": "amd64",
"distro_name": "photon",
Expand Down
6 changes: 4 additions & 2 deletions images/capi/packer/ova/ubuntu-2204-efi.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"boot_command_prefix": "c<wait>linux /casper/vmlinuz ipv6.disable={{ user `boot_disable_ipv6` }} --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/22.04.efi/'<enter><wait>initrd /casper/initrd<enter><wait>boot<enter>",
"boot_command_prefix": "c<wait>linux /casper/vmlinuz ipv6.disable={{ user `boot_disable_ipv6` }} --- autoinstall ds='nocloud;'<enter><wait>initrd /casper/initrd<enter><wait>boot<enter>",
"boot_disable_ipv6": "0",
"boot_media_path": "/media/HTTP",
"build_name": "ubuntu-2204-efi",
"cd_content_location": "./packer/ova/linux/{{user `distro_name`}}/http/{{user `distro_version`}}/*",
"cd_label": "cidata",
"distro_arch": "amd64",
"distro_name": "ubuntu",
"distro_version": "22.04",
"firmware": "efi",
"floppy_dirs": "./packer/ova/linux/{{user `distro_name`}}/http/",
"floppy_dirs": "",
"guest_os_type": "ubuntu-64",
"iso_checksum": "45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2",
"iso_checksum_type": "sha256",
Expand Down
Loading

0 comments on commit a662bf4

Please sign in to comment.