Skip to content

Commit b2550d5

Browse files
feat: add support for amazon linux 2023 (#5336)
* 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
1 parent 1ad7c58 commit b2550d5

File tree

155 files changed

+1495
-420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+1495
-420
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ addons/*/*/assets
1313
addons/*/*/images
1414
addons/*/*/rhel-*
1515
addons/*/*/ubuntu-*
16+
addons/*/*/amazon-*
1617
packages/*/*/assets
1718
packages/*/*/images
1819
packages/*/*/rhel-*

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,21 @@ build/packages/kubernetes/%/rhel-9:
527527
find build/packages/kubernetes/$*/rhel-9 | grep kubectl | grep -v kubectl-$* | xargs rm -vf
528528
docker rm k8s-rhel9-$*
529529

530+
build/packages/kubernetes/%/amazon-2023:
531+
docker build \
532+
--build-arg KUBERNETES_VERSION=$* \
533+
--build-arg KUBERNETES_MINOR_VERSION=$(shell echo $* | sed 's/\.[0-9]*$$//') \
534+
-t kurl/amazon-2023-k8s:$* \
535+
-f bundles/k8s-amazon2023/Dockerfile \
536+
bundles/k8s-amazon2023
537+
-docker rm -f k8s-amazon2023-$* 2>/dev/null
538+
docker create --name k8s-amazon2023-$* kurl/amazon-2023-k8s:$*
539+
mkdir -p build/packages/kubernetes/$*/amazon-2023
540+
docker cp k8s-amazon2023-$*:/packages/archives/. build/packages/kubernetes/$*/amazon-2023/
541+
find build/packages/kubernetes/$*/amazon-2023 | grep kubelet | grep -v kubelet-$* | xargs rm -vf
542+
find build/packages/kubernetes/$*/amazon-2023 | grep kubectl | grep -v kubectl-$* | xargs rm -vf
543+
docker rm k8s-amazon2023-$*
544+
530545
build/templates: build/templates/install.tmpl build/templates/join.tmpl build/templates/upgrade.tmpl build/templates/tasks.tmpl
531546

532547
.PHONY: build/bin ## Build kurl binary

addons/collectd/v5/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function collectd() {
1313
;;
1414

1515
centos|rhel|ol|rocky|amzn)
16-
if [ "$DIST_VERSION_MAJOR" = "8" ] || [ "$DIST_VERSION_MAJOR" = "9" ]; then
16+
if [ "$DIST_VERSION_MAJOR" = "8" ] || [ "$DIST_VERSION_MAJOR" = "9" ] || [ "$DIST_VERSION_MAJOR" = "2023" ] ; then
1717
yum_install_host_archives "$src" collectd collectd-rrdtool collectd-disk
1818
else
1919
yum_install_host_archives "$src" collectd collectd-rrdtool

addons/containerd/1.3.7/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.3.9/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.10/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.11/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.12/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.13/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.3/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.4/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.6/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.8/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.4.9/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spec:
2626
- fail:
2727
when: "ubuntu = 22.04"
2828
message: "containerd addon does not support ubuntu 22.04"
29+
- fail:
30+
when: "amazon >= 2023"
31+
message: "containerd addon does not support amazon 2023"

addons/containerd/1.5.10/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ spec:
5050
- pass:
5151
when: "ubuntu = 22.04"
5252
message: "containerd addon supports ubuntu 22.04"
53+
- pass:
54+
when: "amazon >= 2023"
55+
message: "containerd addon supports amazon 2023"

addons/containerd/1.5.10/install.sh

+34-11
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,30 @@ function containerd_join() {
2626
}
2727

2828
function containerd_install() {
29+
if is_amazon_2023; then
30+
require_amazon2023_containerd
31+
log "Using containerd version provided by the Operating System."
32+
if ! systemctl is-active --quiet containerd; then
33+
systemctl start containerd
34+
fi
35+
fi
36+
2937
local src="$DIR/addons/containerd/$CONTAINERD_VERSION"
3038

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

35-
containerd_migrate_from_docker
36-
37-
containerd_install_container_selinux_if_missing
38-
install_host_packages "$src" containerd.io
39-
40-
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
41-
# If the runc binary is executing the cp command will fail with "text file busy" error.
42-
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
43-
# as soon as the container starts
44-
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
43+
if ! is_amazon_2023; then
44+
containerd_migrate_from_docker
45+
containerd_install_container_selinux_if_missing
46+
install_host_packages "$src" containerd.io
47+
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
48+
# If the runc binary is executing the cp command will fail with "text file busy" error.
49+
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
50+
# as soon as the container starts
51+
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
52+
fi
4553

4654
logStep "Containerd configuration"
4755
containerd_configure
@@ -109,6 +117,7 @@ function containerd_install() {
109117

110118
function containerd_host_init() {
111119
require_centos8_containerd
120+
require_amazon2023_containerd
112121
containerd_install_libzstd_if_missing
113122
}
114123

@@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
121130
return
122131
fi
123132

124-
if is_rhel_9_variant ; then
133+
if ! host_packages_shipped ; then
125134
yum_ensure_host_package libzstd
126135
else
127136
yum_install_host_archives "$src" libzstd
@@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
396405
fi
397406
}
398407

408+
# require_amazon2023_containerd makes sure the OS version of containerd is
409+
# installed.
410+
function require_amazon2023_containerd() {
411+
if ! is_amazon_2023 ; then
412+
return
413+
fi
414+
415+
if yum_is_host_package_installed containerd ; then
416+
return
417+
fi
418+
419+
bail "Containerd is not installed, please install it using the following command: dnf install -y containerd"
420+
}
421+
399422
function require_centos8_containerd() {
400423
if [ "$LSB_DIST" == "centos" ] && [ "$DIST_VERSION_MAJOR" == "8" ]; then
401424
# if this is not centos 8 Stream, require preinstallation of containerd on 1.6.31+

addons/containerd/1.5.11/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ spec:
5050
- pass:
5151
when: "ubuntu = 22.04"
5252
message: "containerd addon supports ubuntu 22.04"
53+
- pass:
54+
when: "amazon >= 2023"
55+
message: "containerd addon supports amazon 2023"

addons/containerd/1.5.11/install.sh

+34-11
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,30 @@ function containerd_join() {
2626
}
2727

2828
function containerd_install() {
29+
if is_amazon_2023; then
30+
require_amazon2023_containerd
31+
log "Using containerd version provided by the Operating System."
32+
if ! systemctl is-active --quiet containerd; then
33+
systemctl start containerd
34+
fi
35+
fi
36+
2937
local src="$DIR/addons/containerd/$CONTAINERD_VERSION"
3038

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

35-
containerd_migrate_from_docker
36-
37-
containerd_install_container_selinux_if_missing
38-
install_host_packages "$src" containerd.io
39-
40-
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
41-
# If the runc binary is executing the cp command will fail with "text file busy" error.
42-
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
43-
# as soon as the container starts
44-
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
43+
if ! is_amazon_2023; then
44+
containerd_migrate_from_docker
45+
containerd_install_container_selinux_if_missing
46+
install_host_packages "$src" containerd.io
47+
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
48+
# If the runc binary is executing the cp command will fail with "text file busy" error.
49+
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
50+
# as soon as the container starts
51+
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
52+
fi
4553

4654
logStep "Containerd configuration"
4755
containerd_configure
@@ -109,6 +117,7 @@ function containerd_install() {
109117

110118
function containerd_host_init() {
111119
require_centos8_containerd
120+
require_amazon2023_containerd
112121
containerd_install_libzstd_if_missing
113122
}
114123

@@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
121130
return
122131
fi
123132

124-
if is_rhel_9_variant ; then
133+
if ! host_packages_shipped ; then
125134
yum_ensure_host_package libzstd
126135
else
127136
yum_install_host_archives "$src" libzstd
@@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
396405
fi
397406
}
398407

408+
# require_amazon2023_containerd makes sure the OS version of containerd is
409+
# installed.
410+
function require_amazon2023_containerd() {
411+
if ! is_amazon_2023 ; then
412+
return
413+
fi
414+
415+
if yum_is_host_package_installed containerd ; then
416+
return
417+
fi
418+
419+
bail "Containerd is not installed, please install it using the following command: dnf install -y containerd"
420+
}
421+
399422
function require_centos8_containerd() {
400423
if [ "$LSB_DIST" == "centos" ] && [ "$DIST_VERSION_MAJOR" == "8" ]; then
401424
# if this is not centos 8 Stream, require preinstallation of containerd on 1.6.31+

addons/containerd/1.6.10/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ spec:
5050
- pass:
5151
when: "ubuntu = 22.04"
5252
message: "containerd addon supports ubuntu 22.04"
53+
- pass:
54+
when: "amazon >= 2023"
55+
message: "containerd addon supports amazon 2023"

addons/containerd/1.6.10/install.sh

+34-11
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,30 @@ function containerd_join() {
2626
}
2727

2828
function containerd_install() {
29+
if is_amazon_2023; then
30+
require_amazon2023_containerd
31+
log "Using containerd version provided by the Operating System."
32+
if ! systemctl is-active --quiet containerd; then
33+
systemctl start containerd
34+
fi
35+
fi
36+
2937
local src="$DIR/addons/containerd/$CONTAINERD_VERSION"
3038

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

35-
containerd_migrate_from_docker
36-
37-
containerd_install_container_selinux_if_missing
38-
install_host_packages "$src" containerd.io
39-
40-
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
41-
# If the runc binary is executing the cp command will fail with "text file busy" error.
42-
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
43-
# as soon as the container starts
44-
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
43+
if ! is_amazon_2023; then
44+
containerd_migrate_from_docker
45+
containerd_install_container_selinux_if_missing
46+
install_host_packages "$src" containerd.io
47+
chmod +x ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc
48+
# If the runc binary is executing the cp command will fail with "text file busy" error.
49+
# Containerd uses runc in detached mode so any runc processes should be short-lived and exit
50+
# as soon as the container starts
51+
try_1m_stderr cp ${DIR}/addons/containerd/${CONTAINERD_VERSION}/assets/runc $(which runc)
52+
fi
4553

4654
logStep "Containerd configuration"
4755
containerd_configure
@@ -109,6 +117,7 @@ function containerd_install() {
109117

110118
function containerd_host_init() {
111119
require_centos8_containerd
120+
require_amazon2023_containerd
112121
containerd_install_libzstd_if_missing
113122
}
114123

@@ -121,7 +130,7 @@ function containerd_install_libzstd_if_missing() {
121130
return
122131
fi
123132

124-
if is_rhel_9_variant ; then
133+
if ! host_packages_shipped ; then
125134
yum_ensure_host_package libzstd
126135
else
127136
yum_install_host_archives "$src" libzstd
@@ -396,6 +405,20 @@ function containerd_kubernetes_pause_image() {
396405
fi
397406
}
398407

408+
# require_amazon2023_containerd makes sure the OS version of containerd is
409+
# installed.
410+
function require_amazon2023_containerd() {
411+
if ! is_amazon_2023 ; then
412+
return
413+
fi
414+
415+
if yum_is_host_package_installed containerd ; then
416+
return
417+
fi
418+
419+
bail "Containerd is not installed, please install it using the following command: dnf install -y containerd"
420+
}
421+
399422
function require_centos8_containerd() {
400423
if [ "$LSB_DIST" == "centos" ] && [ "$DIST_VERSION_MAJOR" == "8" ]; then
401424
# if this is not centos 8 Stream, require preinstallation of containerd on 1.6.31+

addons/containerd/1.6.11/host-preflight.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ spec:
5050
- pass:
5151
when: "ubuntu = 22.04"
5252
message: "containerd addon supports ubuntu 22.04"
53+
- pass:
54+
when: "amazon >= 2023"
55+
message: "containerd addon supports amazon 2023"

0 commit comments

Comments
 (0)