From f7272af5696ad2b2d1f67a8b10a03e5e7ddc4873 Mon Sep 17 00:00:00 2001 From: Tobias Jungel <1773291+toanju@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:38:31 +0100 Subject: [PATCH] Update khost feature for CAPI image 1.30 is outdated --- features/khost | 1 - features/khost/README.md | 19 ++++++++++++ features/khost/exec.late | 11 +++++++ features/khost/file.exclude | 1 + .../etc/modules-load.d/br-nf.conf | 1 + .../file.include/etc/sysctl.d/20-br-nf.conf | 2 ++ .../file.include/etc/sysctl.d/20-inotify.conf | 2 ++ .../etc/sysctl.d/20-ip-forward.conf | 3 ++ features/khost/fstab.mod | 6 ++++ features/khost/info.yaml | 5 ++++ features/khost/pkg.include | 6 ++++ features/khost/release.key | 30 +++++++++++++++++++ features/khost/test/test_packages_musthave.py | 1 + features/khost/test/test_systemd_unit.py | 16 ++++++++++ 14 files changed, 103 insertions(+), 1 deletion(-) delete mode 120000 features/khost create mode 100644 features/khost/README.md create mode 100755 features/khost/exec.late create mode 100644 features/khost/file.exclude create mode 100644 features/khost/file.include/etc/modules-load.d/br-nf.conf create mode 100644 features/khost/file.include/etc/sysctl.d/20-br-nf.conf create mode 100644 features/khost/file.include/etc/sysctl.d/20-inotify.conf create mode 100644 features/khost/file.include/etc/sysctl.d/20-ip-forward.conf create mode 100755 features/khost/fstab.mod create mode 100644 features/khost/info.yaml create mode 100644 features/khost/pkg.include create mode 100644 features/khost/release.key create mode 100644 features/khost/test/test_packages_musthave.py create mode 100644 features/khost/test/test_systemd_unit.py diff --git a/features/khost b/features/khost deleted file mode 120000 index 0b36d54a..00000000 --- a/features/khost +++ /dev/null @@ -1 +0,0 @@ -../gardenlinux/features/khost \ No newline at end of file diff --git a/features/khost/README.md b/features/khost/README.md new file mode 100644 index 00000000..7d71961c --- /dev/null +++ b/features/khost/README.md @@ -0,0 +1,19 @@ +## Feature: khost +### Description + +The khost feature adjusts Garden Linux to support running Kubernetes (vanilla) workloads. + + +### Features +The `khost` feature adjusts Garden Linux to support running Kubernetes (vanilla) workloads and installs and configures all related packages (regarding the used hardware architecture) and tools. It adjusts the `kublets`, `sysctl` and removes any swap partition. + +### Unit testing +Unit tests will ensure that the needed packages are present as well as the `kublet` is enabled within `systemd`. + +### Meta +||| +|---|---| +|type|element| +|artifact|None| +|included_features|`chost`| +|excluded_features|None| diff --git a/features/khost/exec.late b/features/khost/exec.late new file mode 100755 index 00000000..69bcfa62 --- /dev/null +++ b/features/khost/exec.late @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +K8S_VERSION=v1.34.3 +K8S_VERSION_REPO="${K8S_VERSION%.*}" + +gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg < /builder/features/khost/release.key +echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/${K8S_VERSION_REPO}/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list +apt update -y +apt install -y --no-install-recommends "kubelet=${K8S_VERSION#v}*" "kubectl=${K8S_VERSION#v}*" "kubeadm=${K8S_VERSION#v}*" "cri-tools=${K8S_VERSION_REPO#v}*" + diff --git a/features/khost/file.exclude b/features/khost/file.exclude new file mode 100644 index 00000000..82b5c657 --- /dev/null +++ b/features/khost/file.exclude @@ -0,0 +1 @@ +/etc/init.d/apparmor diff --git a/features/khost/file.include/etc/modules-load.d/br-nf.conf b/features/khost/file.include/etc/modules-load.d/br-nf.conf new file mode 100644 index 00000000..a13fc179 --- /dev/null +++ b/features/khost/file.include/etc/modules-load.d/br-nf.conf @@ -0,0 +1 @@ +br_netfilter diff --git a/features/khost/file.include/etc/sysctl.d/20-br-nf.conf b/features/khost/file.include/etc/sysctl.d/20-br-nf.conf new file mode 100644 index 00000000..0454e18a --- /dev/null +++ b/features/khost/file.include/etc/sysctl.d/20-br-nf.conf @@ -0,0 +1,2 @@ +net.bridge.bridge-nf-call-iptables=1 +net.bridge.bridge-nf-call-ip6tables=1 diff --git a/features/khost/file.include/etc/sysctl.d/20-inotify.conf b/features/khost/file.include/etc/sysctl.d/20-inotify.conf new file mode 100644 index 00000000..8f7c9d98 --- /dev/null +++ b/features/khost/file.include/etc/sysctl.d/20-inotify.conf @@ -0,0 +1,2 @@ +fs.inotify.max_user_instances = 8192 +fs.inotify.max_user_watches = 65536 diff --git a/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf b/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf new file mode 100644 index 00000000..5f01c9cd --- /dev/null +++ b/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf @@ -0,0 +1,3 @@ +net.ipv4.ip_forward=1 +net.ipv6.conf.all.forwarding=1 + diff --git a/features/khost/fstab.mod b/features/khost/fstab.mod new file mode 100755 index 00000000..de880d56 --- /dev/null +++ b/features/khost/fstab.mod @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +# remove any swap partition +sed '/^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+[[:space:]]\+swap[[:space:]]\+/d' + diff --git a/features/khost/info.yaml b/features/khost/info.yaml new file mode 100644 index 00000000..1d9d389e --- /dev/null +++ b/features/khost/info.yaml @@ -0,0 +1,5 @@ +description: 'host for kubernetes workloads (vanilla)' +type: element +features: + include: + - chost diff --git a/features/khost/pkg.include b/features/khost/pkg.include new file mode 100644 index 00000000..487a9abe --- /dev/null +++ b/features/khost/pkg.include @@ -0,0 +1,6 @@ +apparmor +conntrack +ethtool +ipvsadm +socat +gnupg diff --git a/features/khost/release.key b/features/khost/release.key new file mode 100644 index 00000000..64f4d8f8 --- /dev/null +++ b/features/khost/release.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +mQENBGMHoXcBCADukGOEQyleViOgtkMVa7hKifP6POCTh+98xNW4TfHK/nBJN2sm +u4XaiUmtB9UuGt9jl8VxQg4hOMRf40coIwHsNwtSrc2R9v5Kgpvcv537QVIigVHH +WMNvXe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EFZ4HjmQ16w5xmcUISnCZd4nhsbS +qN/UyV9Vu3lnkautS15E4CcjP1RRzSkT0jka62vPtAzw+PiGryM1F7svuRaEnJD5 +GXzj9RCUaR6vtFVvqqo4fvbA99k4XXj+dFAXW0TRZ/g2QMePW9cdWielcr+vHF4Z +2EnsAmdvF7r5e2JCOU3N8OUodebU6ws4VgRVG9gptQgfMR0vciBbNDG2Xuk1WDk1 +qtscbfm5FVL36o7dkjA0x+TYCtqZIr4x3mmfAYFUqzxpfyXbSHqUJR2CoWxlyz72 +XnJ7UEo/0UbgzGzscxLPDyJHMM5Dn/Ni9FVTVKlALHnFOYYSTluoYACF1DMt7NJ3 +oyA0MELL0JQzEinixqxpZ1taOmVR/8pQVrqstqwqsp3RABaeZ80JbigUC29zJUVf +=Eplj +-----END PGP PUBLIC KEY BLOCK----- diff --git a/features/khost/test/test_packages_musthave.py b/features/khost/test/test_packages_musthave.py new file mode 100644 index 00000000..4b2783d2 --- /dev/null +++ b/features/khost/test/test_packages_musthave.py @@ -0,0 +1 @@ +from helper.tests.packages_musthave import packages_musthave as test_packages_musthave diff --git a/features/khost/test/test_systemd_unit.py b/features/khost/test/test_systemd_unit.py new file mode 100644 index 00000000..0bc474ab --- /dev/null +++ b/features/khost/test/test_systemd_unit.py @@ -0,0 +1,16 @@ +import pytest +from helper.utils import execute_remote_command +from helper.utils import validate_systemd_unit + + +@pytest.mark.parametrize( + "systemd_unit", + [ + "kubelet" + ] +) + + +def test_systemd_unit(client, systemd_unit, non_provisioner_chroot): + execute_remote_command(client, f"systemctl start {systemd_unit}") + validate_systemd_unit(client, f"{systemd_unit}")