Skip to content

Commit

Permalink
kurl ubuntu 24 04 lts support (#5342)
Browse files Browse the repository at this point in the history
* add and use ensure_host_package function

* k8s packages first pass

* update latest containerd version

* preflight changes

* begin replacing yum_ensure_host_package

* replace yum_ensure_host_package in rook

* update velero to use longhorn_install_nfs_utils_if_missing_common function

* rename function

* fix src
  • Loading branch information
laverya authored Aug 21, 2024
1 parent 03810e6 commit f46f40d
Show file tree
Hide file tree
Showing 71 changed files with 275 additions and 1,014 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ dist/kubernetes-%.tar.gz:
${MAKE} build/packages/kubernetes/$*/ubuntu-18.04
${MAKE} build/packages/kubernetes/$*/ubuntu-20.04
${MAKE} build/packages/kubernetes/$*/ubuntu-22.04
${MAKE} build/packages/kubernetes/$*/ubuntu-24.04
${MAKE} build/packages/kubernetes/$*/rhel-7
${MAKE} build/packages/kubernetes/$*/rhel-7-force
${MAKE} build/packages/kubernetes/$*/rhel-8
Expand Down Expand Up @@ -472,6 +473,19 @@ build/packages/kubernetes/%/ubuntu-22.04:
docker cp k8s-ubuntu2204-$*:/packages/archives/. build/packages/kubernetes/$*/ubuntu-22.04/
docker rm k8s-ubuntu2204-$*

build/packages/kubernetes/%/ubuntu-24.04:
docker build \
--build-arg KUBERNETES_VERSION=$* \
--build-arg KUBERNETES_MINOR_VERSION=$(shell echo $* | sed 's/\.[0-9]*$$//') \
-t kurl/ubuntu-2404-k8s:$* \
-f bundles/k8s-ubuntu2404/Dockerfile \
bundles/k8s-ubuntu2404
-docker rm -f k8s-ubuntu2404-$* 2>/dev/null
docker create --name k8s-ubuntu2404-$* kurl/ubuntu-2404-k8s:$*
mkdir -p build/packages/kubernetes/$*/ubuntu-24.04
docker cp k8s-ubuntu2404-$*:/archives/. build/packages/kubernetes/$*/ubuntu-24.04/
docker rm k8s-ubuntu2404-$*

build/packages/kubernetes/%/rhel-7:
docker build \
--build-arg KUBERNETES_VERSION=$* \
Expand Down
47 changes: 37 additions & 10 deletions addons/containerd/1.6.33/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function containerd_join() {
}

function containerd_install() {
if is_amazon_2023; then
require_amazon2023_containerd
if use_os_containerd; then
require_os_containerd
log "Using containerd version provided by the Operating System."
if ! systemctl is-active --quiet containerd; then
systemctl start containerd
Expand All @@ -40,7 +40,7 @@ function containerd_install() {
bail "The filesystem mounted at /var/lib/containerd does not have ftype enabled"
fi

if ! is_amazon_2023; then
if ! use_os_containerd; then
containerd_migrate_from_docker
containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io
Expand Down Expand Up @@ -124,17 +124,17 @@ function containerd_host_init() {
function containerd_install_libzstd_if_missing() {
local src="$DIR/addons/containerd/$CONTAINERD_VERSION"

if ! host_packages_shipped ; then
ensure_host_package libzstd skip
return
fi

case "$LSB_DIST" in
centos|rhel|ol|rocky|amzn)
if yum_is_host_package_installed libzstd ; then
return
fi

if ! host_packages_shipped ; then
yum_ensure_host_package libzstd
else
yum_install_host_archives "$src" libzstd
fi
yum_install_host_archives "$src" libzstd
;;
esac
}
Expand Down Expand Up @@ -405,8 +405,23 @@ function containerd_kubernetes_pause_image() {
fi
}

# require_amazon2023_containerd makes sure the OS version of containerd is
function use_os_containerd() {
if is_amazon_2023 || is_ubuntu_2404 ; then
return 0
fi
return 1
}

# require_os_containerd makes sure the OS version of containerd is
# installed.
function require_os_containerd() {
if is_amazon_2023 ; then
require_amazon2023_containerd
elif is_ubuntu_2404 ; then
require_ubuntu2404_containerd
fi
}

function require_amazon2023_containerd() {
if ! is_amazon_2023 ; then
return
Expand All @@ -419,6 +434,18 @@ function require_amazon2023_containerd() {
bail "Containerd is not installed, please install it using the following command: dnf install -y containerd"
}

function require_ubuntu2404_containerd() {
if ! is_ubuntu_2404 ; then
return
fi

if apt_is_host_package_installed containerd ; then
return
fi

bail "Containerd is not installed, please install it using the following command: apt-get install -y containerd"
}

function require_centos8_containerd() {
if [ "$LSB_DIST" == "centos" ] && [ "$DIST_VERSION_MAJOR" == "8" ]; then
# if this is not centos 8 Stream, require preinstallation of containerd on 1.6.31+
Expand Down
47 changes: 37 additions & 10 deletions addons/containerd/template/base/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function containerd_join() {
}

function containerd_install() {
if is_amazon_2023; then
require_amazon2023_containerd
if use_os_containerd; then
require_os_containerd
log "Using containerd version provided by the Operating System."
if ! systemctl is-active --quiet containerd; then
systemctl start containerd
Expand All @@ -40,7 +40,7 @@ function containerd_install() {
bail "The filesystem mounted at /var/lib/containerd does not have ftype enabled"
fi

if ! is_amazon_2023; then
if ! use_os_containerd; then
containerd_migrate_from_docker
containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io
Expand Down Expand Up @@ -124,17 +124,17 @@ function containerd_host_init() {
function containerd_install_libzstd_if_missing() {
local src="$DIR/addons/containerd/$CONTAINERD_VERSION"

if ! host_packages_shipped ; then
ensure_host_package libzstd skip
return
fi

case "$LSB_DIST" in
centos|rhel|ol|rocky|amzn)
if yum_is_host_package_installed libzstd ; then
return
fi

if ! host_packages_shipped ; then
yum_ensure_host_package libzstd
else
yum_install_host_archives "$src" libzstd
fi
yum_install_host_archives "$src" libzstd
;;
esac
}
Expand Down Expand Up @@ -405,8 +405,23 @@ function containerd_kubernetes_pause_image() {
fi
}

# require_amazon2023_containerd makes sure the OS version of containerd is
function use_os_containerd() {
if is_amazon_2023 || is_ubuntu_2404 ; then
return 0
fi
return 1
}

# require_os_containerd makes sure the OS version of containerd is
# installed.
function require_os_containerd() {
if is_amazon_2023 ; then
require_amazon2023_containerd
elif is_ubuntu_2404 ; then
require_ubuntu2404_containerd
fi
}

function require_amazon2023_containerd() {
if ! is_amazon_2023 ; then
return
Expand All @@ -419,6 +434,18 @@ function require_amazon2023_containerd() {
bail "Containerd is not installed, please install it using the following command: dnf install -y containerd"
}

function require_ubuntu2404_containerd() {
if ! is_ubuntu_2404 ; then
return
fi

if apt_is_host_package_installed containerd ; then
return
fi

bail "Containerd is not installed, please install it using the following command: apt-get install -y containerd"
}

function require_centos8_containerd() {
if [ "$LSB_DIST" == "centos" ] && [ "$DIST_VERSION_MAJOR" == "8" ]; then
# if this is not centos 8 Stream, require preinstallation of containerd on 1.6.31+
Expand Down
60 changes: 2 additions & 58 deletions addons/longhorn/1.1.0/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,62 +81,6 @@ function longhorn_join() {
}

function longhorn_host_init() {
longhorn_install_iscsi_if_missing
longhorn_install_nfs_utils_if_missing
}

function longhorn_install_iscsi_if_missing() {
local src="$DIR/addons/longhorn/$LONGHORN_VERSION"

if ! systemctl list-units | grep -q iscsid ; then
case "$LSB_DIST" in
ubuntu)
dpkg_install_host_archives "$src" open-iscsi
;;

centos|rhel|ol|rocky|amzn)
if ! host_packages_shipped ; then
yum_ensure_host_package iscsi-initiator-utils
else
yum_install_host_archives "$src" iscsi-initiator-utils
fi
;;
esac
fi

if ! systemctl -q is-active iscsid; then
systemctl start iscsid
fi

if ! systemctl -q is-enabled iscsid; then
systemctl enable iscsid
fi
}

function longhorn_install_nfs_utils_if_missing() {
local src="$DIR/addons/longhorn/$LONGHORN_VERSION"

if ! systemctl list-units | grep -q nfs-utils ; then
case "$LSB_DIST" in
ubuntu)
dpkg_install_host_archives "$src" nfs-common
;;

centos|rhel|ol|rocky|amzn)
if ! host_packages_shipped ; then
yum_ensure_host_package nfs-utils
else
yum_install_host_archives "$src" nfs-utils
fi
;;
esac
fi

if ! systemctl -q is-active nfs-utils; then
systemctl start nfs-utils
fi

if ! systemctl -q is-enabled nfs-utils; then
systemctl enable nfs-utils
fi
longhorn_install_iscsi_if_missing_common "$DIR/addons/longhorn/$LONGHORN_VERSION"
install_nfs_utils_if_missing_common "$DIR/addons/longhorn/$LONGHORN_VERSION"
}
60 changes: 2 additions & 58 deletions addons/longhorn/1.1.1/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,68 +89,12 @@ function longhorn_join() {
}

function longhorn_host_init() {
longhorn_install_iscsi_if_missing
longhorn_install_nfs_utils_if_missing
longhorn_install_iscsi_if_missing_common "$DIR/addons/longhorn/$LONGHORN_VERSION"
install_nfs_utils_if_missing_common "$DIR/addons/longhorn/$LONGHORN_VERSION"
mkdir -p /var/lib/longhorn
chmod 700 /var/lib/longhorn
}

function longhorn_install_iscsi_if_missing() {
local src="$DIR/addons/longhorn/$LONGHORN_VERSION"

if ! systemctl list-units | grep -q iscsid ; then
case "$LSB_DIST" in
ubuntu)
dpkg_install_host_archives "$src" open-iscsi
;;

centos|rhel|ol|rocky|amzn)
if ! host_packages_shipped ; then
yum_ensure_host_package iscsi-initiator-utils
else
yum_install_host_archives "$src" iscsi-initiator-utils
fi
;;
esac
fi

if ! systemctl -q is-active iscsid; then
systemctl start iscsid
fi

if ! systemctl -q is-enabled iscsid; then
systemctl enable iscsid
fi
}

function longhorn_install_nfs_utils_if_missing() {
local src="$DIR/addons/longhorn/$LONGHORN_VERSION"

if ! systemctl list-units | grep -q nfs-utils ; then
case "$LSB_DIST" in
ubuntu)
dpkg_install_host_archives "$src" nfs-common
;;

centos|rhel|ol|rocky|amzn)
if ! host_packages_shipped ; then
yum_ensure_host_package nfs-utils
else
yum_install_host_archives "$src" nfs-utils
fi
;;
esac
fi

if ! systemctl -q is-active nfs-utils; then
systemctl start nfs-utils
fi

if ! systemctl -q is-enabled nfs-utils; then
systemctl enable nfs-utils
fi
}

function check_mount_propagation() {
local src=$1

Expand Down
Loading

0 comments on commit f46f40d

Please sign in to comment.