Skip to content

Commit

Permalink
feat: add support for amazon linux 2023 (#5336)
Browse files Browse the repository at this point in the history
* feat: add support for amazon linux 2023

adds support for amazon linux 2023. one thing is different in comparison
with other operating system's, we do not install containerd.io package,
we go with the default containerd provided by amazon.

* chore: adding amazon 2023 to testgrid

* chore: disable docker tests on amazon 2023
  • Loading branch information
ricardomaraschini authored Aug 20, 2024
1 parent 1ad7c58 commit b2550d5
Show file tree
Hide file tree
Showing 155 changed files with 1,495 additions and 420 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ addons/*/*/assets
addons/*/*/images
addons/*/*/rhel-*
addons/*/*/ubuntu-*
addons/*/*/amazon-*
packages/*/*/assets
packages/*/*/images
packages/*/*/rhel-*
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,21 @@ build/packages/kubernetes/%/rhel-9:
find build/packages/kubernetes/$*/rhel-9 | grep kubectl | grep -v kubectl-$* | xargs rm -vf
docker rm k8s-rhel9-$*

build/packages/kubernetes/%/amazon-2023:
docker build \
--build-arg KUBERNETES_VERSION=$* \
--build-arg KUBERNETES_MINOR_VERSION=$(shell echo $* | sed 's/\.[0-9]*$$//') \
-t kurl/amazon-2023-k8s:$* \
-f bundles/k8s-amazon2023/Dockerfile \
bundles/k8s-amazon2023
-docker rm -f k8s-amazon2023-$* 2>/dev/null
docker create --name k8s-amazon2023-$* kurl/amazon-2023-k8s:$*
mkdir -p build/packages/kubernetes/$*/amazon-2023
docker cp k8s-amazon2023-$*:/packages/archives/. build/packages/kubernetes/$*/amazon-2023/
find build/packages/kubernetes/$*/amazon-2023 | grep kubelet | grep -v kubelet-$* | xargs rm -vf
find build/packages/kubernetes/$*/amazon-2023 | grep kubectl | grep -v kubectl-$* | xargs rm -vf
docker rm k8s-amazon2023-$*

build/templates: build/templates/install.tmpl build/templates/join.tmpl build/templates/upgrade.tmpl build/templates/tasks.tmpl

.PHONY: build/bin ## Build kurl binary
Expand Down
2 changes: 1 addition & 1 deletion addons/collectd/v5/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function collectd() {
;;

centos|rhel|ol|rocky|amzn)
if [ "$DIST_VERSION_MAJOR" = "8" ] || [ "$DIST_VERSION_MAJOR" = "9" ]; then
if [ "$DIST_VERSION_MAJOR" = "8" ] || [ "$DIST_VERSION_MAJOR" = "9" ] || [ "$DIST_VERSION_MAJOR" = "2023" ] ; then
yum_install_host_archives "$src" collectd collectd-rrdtool collectd-disk
else
yum_install_host_archives "$src" collectd collectd-rrdtool
Expand Down
3 changes: 3 additions & 0 deletions addons/containerd/1.3.7/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.3.9/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.10/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.11/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.12/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.13/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.3/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.4/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.6/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.8/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.4.9/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ spec:
- fail:
when: "ubuntu = 22.04"
message: "containerd addon does not support ubuntu 22.04"
- fail:
when: "amazon >= 2023"
message: "containerd addon does not support amazon 2023"
3 changes: 3 additions & 0 deletions addons/containerd/1.5.10/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ spec:
- pass:
when: "ubuntu = 22.04"
message: "containerd addon supports ubuntu 22.04"
- pass:
when: "amazon >= 2023"
message: "containerd addon supports amazon 2023"
45 changes: 34 additions & 11 deletions addons/containerd/1.5.10/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ function containerd_join() {
}

function containerd_install() {
if is_amazon_2023; then
require_amazon2023_containerd
log "Using containerd version provided by the Operating System."
if ! systemctl is-active --quiet containerd; then
systemctl start containerd
fi
fi

local src="$DIR/addons/containerd/$CONTAINERD_VERSION"

if ! containerd_xfs_ftype_enabled; then
bail "The filesystem mounted at /var/lib/containerd does not have ftype enabled"
fi

containerd_migrate_from_docker

containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io

chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
if ! is_amazon_2023; then
containerd_migrate_from_docker
containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
fi

logStep "Containerd configuration"
containerd_configure
Expand Down Expand Up @@ -109,6 +117,7 @@ function containerd_install() {

function containerd_host_init() {
require_centos8_containerd
require_amazon2023_containerd
containerd_install_libzstd_if_missing
}

Expand All @@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
return
fi

if is_rhel_9_variant ; then
if ! host_packages_shipped ; then
yum_ensure_host_package libzstd
else
yum_install_host_archives "$src" libzstd
Expand Down Expand Up @@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
fi
}

# require_amazon2023_containerd makes sure the OS version of containerd is
# installed.
function require_amazon2023_containerd() {
if ! is_amazon_2023 ; then
return
fi

if yum_is_host_package_installed containerd ; then
return
fi

bail "Containerd is not installed, please install it using the following command: dnf 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
3 changes: 3 additions & 0 deletions addons/containerd/1.5.11/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ spec:
- pass:
when: "ubuntu = 22.04"
message: "containerd addon supports ubuntu 22.04"
- pass:
when: "amazon >= 2023"
message: "containerd addon supports amazon 2023"
45 changes: 34 additions & 11 deletions addons/containerd/1.5.11/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ function containerd_join() {
}

function containerd_install() {
if is_amazon_2023; then
require_amazon2023_containerd
log "Using containerd version provided by the Operating System."
if ! systemctl is-active --quiet containerd; then
systemctl start containerd
fi
fi

local src="$DIR/addons/containerd/$CONTAINERD_VERSION"

if ! containerd_xfs_ftype_enabled; then
bail "The filesystem mounted at /var/lib/containerd does not have ftype enabled"
fi

containerd_migrate_from_docker

containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io

chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
if ! is_amazon_2023; then
containerd_migrate_from_docker
containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
fi

logStep "Containerd configuration"
containerd_configure
Expand Down Expand Up @@ -109,6 +117,7 @@ function containerd_install() {

function containerd_host_init() {
require_centos8_containerd
require_amazon2023_containerd
containerd_install_libzstd_if_missing
}

Expand All @@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
return
fi

if is_rhel_9_variant ; then
if ! host_packages_shipped ; then
yum_ensure_host_package libzstd
else
yum_install_host_archives "$src" libzstd
Expand Down Expand Up @@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
fi
}

# require_amazon2023_containerd makes sure the OS version of containerd is
# installed.
function require_amazon2023_containerd() {
if ! is_amazon_2023 ; then
return
fi

if yum_is_host_package_installed containerd ; then
return
fi

bail "Containerd is not installed, please install it using the following command: dnf 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
3 changes: 3 additions & 0 deletions addons/containerd/1.6.10/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ spec:
- pass:
when: "ubuntu = 22.04"
message: "containerd addon supports ubuntu 22.04"
- pass:
when: "amazon >= 2023"
message: "containerd addon supports amazon 2023"
45 changes: 34 additions & 11 deletions addons/containerd/1.6.10/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ function containerd_join() {
}

function containerd_install() {
if is_amazon_2023; then
require_amazon2023_containerd
log "Using containerd version provided by the Operating System."
if ! systemctl is-active --quiet containerd; then
systemctl start containerd
fi
fi

local src="$DIR/addons/containerd/$CONTAINERD_VERSION"

if ! containerd_xfs_ftype_enabled; then
bail "The filesystem mounted at /var/lib/containerd does not have ftype enabled"
fi

containerd_migrate_from_docker

containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io

chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
if ! is_amazon_2023; then
containerd_migrate_from_docker
containerd_install_container_selinux_if_missing
install_host_packages "$src" containerd.io
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
# If the runc binary is executing the cp command will fail with "text file busy" error.
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
# as soon as the container starts
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
fi

logStep "Containerd configuration"
containerd_configure
Expand Down Expand Up @@ -109,6 +117,7 @@ function containerd_install() {

function containerd_host_init() {
require_centos8_containerd
require_amazon2023_containerd
containerd_install_libzstd_if_missing
}

Expand All @@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
return
fi

if is_rhel_9_variant ; then
if ! host_packages_shipped ; then
yum_ensure_host_package libzstd
else
yum_install_host_archives "$src" libzstd
Expand Down Expand Up @@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
fi
}

# require_amazon2023_containerd makes sure the OS version of containerd is
# installed.
function require_amazon2023_containerd() {
if ! is_amazon_2023 ; then
return
fi

if yum_is_host_package_installed containerd ; then
return
fi

bail "Containerd is not installed, please install it using the following command: dnf 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
3 changes: 3 additions & 0 deletions addons/containerd/1.6.11/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ spec:
- pass:
when: "ubuntu = 22.04"
message: "containerd addon supports ubuntu 22.04"
- pass:
when: "amazon >= 2023"
message: "containerd addon supports amazon 2023"
Loading

0 comments on commit b2550d5

Please sign in to comment.