From 1698e82a8f9bc02365cf93ccaeb1170b05bc4fa3 Mon Sep 17 00:00:00 2001 From: Maksim Paskal Date: Sun, 14 Apr 2024 15:12:36 +0100 Subject: [PATCH] prepare to ubuntu 22.04 (#111) Signed-off-by: Maksim Paskal --- README.md | 14 ++++----- config.yaml | 11 ++++--- e2e/configs/full.yaml | 2 +- e2e/configs/v1.25.yaml | 2 +- e2e/configs/v1.26.yaml | 2 +- e2e/configs/v1.27.yaml | 2 +- e2e/configs/v1.28-amd64-eu-central-fsn1.yaml | 2 +- e2e/configs/v1.28-amd64-ubuntu-22.04.yaml | 12 +++++++ e2e/configs/v1.28-amd64-us-east-ash.yaml | 2 +- e2e/configs/v1.28-arm64-ubuntu-22.04.yaml | 20 ++++++++++++ e2e/configs/v1.28-arm64.yaml | 2 +- pkg/config/config.go | 2 +- scripts/common-install.sh | 3 +- scripts/upgrade-release.sh | 33 ++++++++++++++++++++ 14 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 e2e/configs/v1.28-amd64-ubuntu-22.04.yaml create mode 100644 e2e/configs/v1.28-arm64-ubuntu-22.04.yaml create mode 100644 scripts/upgrade-release.sh diff --git a/README.md b/README.md index 46a7aeb..ece6b7a 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ serverComponents: docker: # customize apt package version for docker install # apt-cache madison docker-ce - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: # customize apt package version for containerd install # apt-cache madison containerd.io @@ -107,7 +107,7 @@ serverComponents: kubernetes: version: 1.25.14 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 cluster-autoscaler: @@ -141,7 +141,7 @@ serverComponents: kubernetes: version: 1.26.9 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 @@ -156,7 +156,7 @@ serverComponents: kubernetes: version: 1.27.6 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 @@ -171,7 +171,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 @@ -191,7 +191,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 cluster-autoscaler: @@ -212,7 +212,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 masterServers: diff --git a/config.yaml b/config.yaml index 78c1c93..4d8fc4b 100644 --- a/config.yaml +++ b/config.yaml @@ -1,7 +1,10 @@ ipRange: "10.0.0.0/16" masterCount: 3 +serverComponents: + ubuntu: + version: ubuntu-22.04 # files for custom install -# masterServers: -# serversinitparams: -# targz: https://github.com/maksim-paskal/hcloud-k8s-ctl/archive/refs/heads/add-post-install.tar.gz -# folder: hcloud-k8s-ctl-add-post-install \ No newline at end of file +masterServers: + serversinitparams: + targz: https://github.com/maksim-paskal/hcloud-k8s-ctl/archive/refs/heads/prepare-to-ubuntu-22.04.tar.gz + folder: hcloud-k8s-ctl-prepare-to-ubuntu-22.04 \ No newline at end of file diff --git a/e2e/configs/full.yaml b/e2e/configs/full.yaml index 3856794..e4e1079 100644 --- a/e2e/configs/full.yaml +++ b/e2e/configs/full.yaml @@ -7,7 +7,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 pausecontainer: registry.k8s.io/pause:3.2 diff --git a/e2e/configs/v1.25.yaml b/e2e/configs/v1.25.yaml index d9acd19..f72e6a0 100644 --- a/e2e/configs/v1.25.yaml +++ b/e2e/configs/v1.25.yaml @@ -5,7 +5,7 @@ serverComponents: kubernetes: version: 1.25.14 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 cluster-autoscaler: diff --git a/e2e/configs/v1.26.yaml b/e2e/configs/v1.26.yaml index fb2faaa..1d70fa2 100644 --- a/e2e/configs/v1.26.yaml +++ b/e2e/configs/v1.26.yaml @@ -5,6 +5,6 @@ serverComponents: kubernetes: version: 1.26.9 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 diff --git a/e2e/configs/v1.27.yaml b/e2e/configs/v1.27.yaml index fd93cb4..3a1f727 100644 --- a/e2e/configs/v1.27.yaml +++ b/e2e/configs/v1.27.yaml @@ -5,6 +5,6 @@ serverComponents: kubernetes: version: 1.27.6 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 diff --git a/e2e/configs/v1.28-amd64-eu-central-fsn1.yaml b/e2e/configs/v1.28-amd64-eu-central-fsn1.yaml index 817fa3d..c85b46f 100644 --- a/e2e/configs/v1.28-amd64-eu-central-fsn1.yaml +++ b/e2e/configs/v1.28-amd64-eu-central-fsn1.yaml @@ -5,6 +5,6 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 diff --git a/e2e/configs/v1.28-amd64-ubuntu-22.04.yaml b/e2e/configs/v1.28-amd64-ubuntu-22.04.yaml new file mode 100644 index 0000000..b440855 --- /dev/null +++ b/e2e/configs/v1.28-amd64-ubuntu-22.04.yaml @@ -0,0 +1,12 @@ +# Kubernetes v1.28 in Europe (ARM64 architecture) +ipRange: "10.0.0.0/16" +masterCount: 3 +serverComponents: + ubuntu: + version: ubuntu-22.04 + kubernetes: + version: 1.28.2 + docker: + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) + containerd: + version: 1.6.24-1 diff --git a/e2e/configs/v1.28-amd64-us-east-ash.yaml b/e2e/configs/v1.28-amd64-us-east-ash.yaml index a73eddb..37ca28e 100644 --- a/e2e/configs/v1.28-amd64-us-east-ash.yaml +++ b/e2e/configs/v1.28-amd64-us-east-ash.yaml @@ -10,7 +10,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 cluster-autoscaler: diff --git a/e2e/configs/v1.28-arm64-ubuntu-22.04.yaml b/e2e/configs/v1.28-arm64-ubuntu-22.04.yaml new file mode 100644 index 0000000..b9fb9d0 --- /dev/null +++ b/e2e/configs/v1.28-arm64-ubuntu-22.04.yaml @@ -0,0 +1,20 @@ +# Kubernetes v1.28 in Europe (ARM64 architecture) +ipRange: "10.0.0.0/16" +masterCount: 3 +serverComponents: + ubuntu: + version: ubuntu-22.04 + architecture: arm + kubernetes: + version: 1.28.2 + docker: + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) + containerd: + version: 1.6.24-1 +masterServers: + servertype: cax11 +cluster-autoscaler: + autoscalingGroups: + - name: CAX41:FSN1:cax-fsn1 + minSize: 1 + maxSize: 20 diff --git a/e2e/configs/v1.28-arm64.yaml b/e2e/configs/v1.28-arm64.yaml index a5c1ec7..1129dba 100644 --- a/e2e/configs/v1.28-arm64.yaml +++ b/e2e/configs/v1.28-arm64.yaml @@ -7,7 +7,7 @@ serverComponents: kubernetes: version: 1.28.2 docker: - version: 5:24.0.6-1~ubuntu.20.04~focal + version: 5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs) containerd: version: 1.6.24-1 masterServers: diff --git a/pkg/config/config.go b/pkg/config/config.go index 2bad7c4..9667b15 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -207,7 +207,7 @@ func defaultConfig() Type { Version: "1.28.2", }, Docker: serverComponentDocker{ - Version: "5:24.0.6-1~ubuntu.20.04~focal", + Version: "5:24.0.6-1~ubuntu.$(lsb_release -rs)~$(lsb_release -cs)", }, Containerd: serverComponentContainerd{ Version: "1.6.24-1", diff --git a/scripts/common-install.sh b/scripts/common-install.sh index d4d6c2d..3a41ec9 100755 --- a/scripts/common-install.sh +++ b/scripts/common-install.sh @@ -40,7 +40,8 @@ ca-certificates \ curl \ software-properties-common \ nfs-common \ -linux-headers-generic +linux-headers-generic \ +lsb-release # create new user to ssh into server hcloud_user="{{ .Values.serverComponents.ubuntu.username }}" diff --git a/scripts/upgrade-release.sh b/scripts/upgrade-release.sh new file mode 100644 index 0000000..5e3aff3 --- /dev/null +++ b/scripts/upgrade-release.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# Copyright paskal.maksim@gmail.com +# +# 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. +set -ex + +export DEBIAN_FRONTEND=noninteractive + +# make full-upgrade before release-upgrade + +apt remove -y --allow-change-held-packages docker-ce docker-ce-cli containerd.io kubelet kubeadm kubectl +apt -y autoremove +apt -y autoclean + +# make full non-interactive +echo 'DPkg::options { "--force-confdef"; "--force-confnew"; }' > /etc/apt/apt.conf.d/local + +do-release-upgrade -f DistUpgradeViewNonInteractive + +reboot + +# after reboot, /root/scripts/common-install.sh \ No newline at end of file