11# shellcheck disable=SC2120
22GO_URLDIR=https://golang.org/dl
3- GO_VERSION=1.19.1
3+ GO_VERSION=1.22.6
44GOLANG_URL=$GO_URLDIR /go$GO_VERSION .linux-amd64.tar.gz
55CRICTL_VERSION=${CRICTL_VERSION:- " v1.25.0" }
66MINIKUBE_VERSION=${MINIKUBE_VERSION:- v1.27.0}
@@ -87,7 +87,6 @@ distro-resolve-fn() {
8787 candidates=" ${VM_DISTRO/ ./ _} -$apifn ${VM_DISTRO%% -* } -$apifn "
8888 case $VM_DISTRO in
8989 ubuntu* ) candidates=" $candidates debian-$apifn " ;;
90- centos* ) candidates=" $candidates fedora-$apifn rpm-$apifn " ;;
9190 fedora* ) candidates=" $candidates rpm-$apifn " ;;
9291 * suse* ) candidates=" $candidates rpm-$apifn " ;;
9392 sles* ) candidates=" $candidates opensuse-$apifn rpm-$apifn " ;;
@@ -114,7 +113,7 @@ distro-unresolved() {
114113# ##########################################################################
115114
116115#
117- # Ubuntu 18.04, 20.04, Debian 10, generic debian
116+ # Ubuntu, Debian
118117#
119118
120119ubuntu-18_04-image-url () {
@@ -129,6 +128,10 @@ ubuntu-22_04-image-url() {
129128 echo " https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64.img"
130129}
131130
131+ ubuntu-24_04-image-url () {
132+ echo " https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
133+ }
134+
132135debian-10-image-url () {
133136 echo " https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-amd64.qcow2"
134137}
@@ -277,17 +280,28 @@ debian-install-crio-pre() {
277280}
278281
279282debian-install-k8s () {
280- local k8sverparam
283+ local _k8s= $k8s
281284 debian-refresh-pkg-db
282- debian-install-pkg apt-transport-https curl
283- debian-install-repo-key " https://packages.cloud.google.com/apt/doc/apt-key.gpg"
284- debian-install-repo " deb https://apt.kubernetes.io/ kubernetes-xenial main"
285- if [ -n " $k8s " ]; then
286- k8sverparam=" =${k8s} -00"
285+ debian-install-pkg gpg apt-transport-https curl
286+
287+ if [[ -z " $k8s " ]] || [[ " $k8s " == " latest" ]]; then
288+ vm-command " curl -s https://api.github.com/repos/kubernetes/kubernetes/releases/latest | grep tag_name | sed -e 's/.*v\([0-9]\+\.[0-9]\+\).*/\1/g'"
289+ _k8s=$COMMAND_OUTPUT
290+ fi
291+ echo " installing Kubernetes v${_k8s} "
292+ vm-command " curl -fsSL https://pkgs.k8s.io/core:/stable:/v${_k8s} /deb/Release.key -o /tmp/Release.key" || \
293+ command-error " failed to download Kubernetes v${_k8s} key"
294+
295+ if vm-command " command -v apt-key >/dev/null" ; then
296+ vm-command " sudo apt-key add /tmp/Release.key"
297+ vm-command " echo 'deb https://pkgs.k8s.io/core:/stable:/v${_k8s} /deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
298+ command-error " failed to add Kubernetes v${_k8s} repo"
287299 else
288- k8sverparam=" "
300+ vm-command " sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg /tmp/Release.key"
301+ vm-command " echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${_k8s} /deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
302+ command-error " failed to add Kubernetes v${_k8s} repo"
289303 fi
290- debian-install-pkg " kubeadm$k8sverparam " " kubelet$k8sverparam " " kubectl$k8sverparam "
304+ debian-install-pkg " kubeadm" " kubelet" " kubectl"
291305}
292306
293307debian-set-kernel-cmdline () {
@@ -304,106 +318,25 @@ debian-env-file-dir() {
304318 echo " /etc/default"
305319}
306320
321+ debian-sid-govm-env () {
322+ echo " DISABLE_VGA=N"
323+ }
324+
307325# ##########################################################################
308326
309327#
310- # Centos 7, 8, generic Fedora
328+ # Generic Fedora
311329#
312330
313331YUM_INSTALL=" yum install --disableplugin=fastestmirror -y"
314332YUM_REMOVE=" yum remove --disableplugin=fastestmirror -y"
315333
316- centos-7-image-url () {
317- echo " https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2003.qcow2.xz"
318- }
319-
320- centos-8-image-url () {
321- echo " https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2"
322- }
323-
324- centos-ssh-user () {
325- echo centos
326- }
327-
328- centos-7-install-utils () {
329- distro-install-pkg /usr/bin/killall
330- }
331-
332- centos-7-install-repo () {
333- vm-command-q " type -t yum-config-manager >&/dev/null" || {
334- distro-install-pkg yum-utils
335- }
336- vm-command " yum-config-manager --add-repo $* " ||
337- command-error " failed to add YUM repository $* "
338- }
339-
340- centos-7-install-pkg () {
341- vm-command " $YUM_INSTALL $* " ||
342- command-error " failed to install $* "
343- }
344-
345- centos-7-remove-pkg () {
346- vm-command " $YUM_REMOVE $* " ||
347- command-error " failed to remove package(s) $* "
348- }
349-
350- centos-7-install-containerd-pre () {
351- create-ext4-var-lib-containerd
352- distro-install-repo https://download.docker.com/linux/centos/docker-ce.repo
353- }
354-
355- centos-8-install-pkg-pre () {
356- vm-command " [ -f /etc/yum.repos.d/.fixup ]" && return 0
357- vm-command ' sed -i "s/mirrorlist/#mirrorlist/g" /etc/yum.repos.d/CentOS-*' && \
358- vm-command ' sed -i "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*' && \
359- vm-command ' touch /etc/yum.repos.d/.fixup'
360- }
361-
362- centos-8-install-crio-pre () {
363- if [ -z " $crio_src " ]; then
364- local os=CentOS_8
365- local version=${crio_version:- 1.20}
366- vm-command " curl -L -o /etc/yum.repos.d/libcontainers-stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$os /devel:kubic:libcontainers:stable.repo"
367- vm-command " curl -L -o /etc/yum.repos.d/crio.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$version /$os /devel:kubic:libcontainers:stable:cri-o:$version .repo"
368- fi
369- }
370-
371- centos-8-install-crio () {
372- if [ -n " $crio_src " ]; then
373- default-install-crio
374- else
375- distro-install-pkg cri-o
376- vm-command " systemctl enable crio"
377- fi
378- }
379-
380- centos-8-install-containerd-pre () {
381- distro-install-repo https://download.docker.com/linux/centos/docker-ce.repo
382- }
383-
384- centos-install-golang () {
385- distro-install-pkg wget tar gzip git-core
386- from-tarball-install-golang
387- }
388-
389334fedora-image-url () {
390- fedora-38 -image-url
335+ fedora-40 -image-url
391336}
392337
393- fedora-38-image-url () {
394- echo " https://mirrors.xtom.de/fedora/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.qcow2"
395- }
396-
397- fedora-35-image-url () {
398- echo " https://mirrors.xtom.de/fedora/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2"
399- }
400-
401- fedora-34-image-url () {
402- echo " https://mirrors.xtom.de/fedora/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2"
403- }
404-
405- fedora-33-image-url () {
406- echo " https://mirrors.xtom.de/fedora/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2"
338+ fedora-40-image-url () {
339+ echo " https://mirrors.xtom.de/fedora/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2"
407340}
408341
409342fedora-ssh-user () {
@@ -468,7 +401,7 @@ fedora-install-kernel-dev() {
468401 fedpkg clone -a kernel
469402 cd kernel
470403 git fetch
471- git switch ${VM_DISTRO/ edora-/ } # example: git switch f35 in fedora-35
404+ git switch ${VM_DISTRO/ edora-/ } # example: git switch f40 in fedora-40
472405 sed -i 's/# define buildid .local/%define buildid .e2e/g' kernel.spec
473406 )" || {
474407 echo " installing kernel development environment failed"
@@ -530,19 +463,21 @@ fedora-install-containerd-post() {
530463}
531464
532465fedora-install-k8s () {
466+ _k8s=$k8s
467+ if [[ -z " $_k8s " ]] || [[ " $_k8s " == " latest" ]]; then
468+ vm-command " curl -s https://api.github.com/repos/kubernetes/kubernetes/releases/latest | grep tag_name | sed -e 's/.*v\([0-9]\+\.[0-9]\+\).*/\1/g'"
469+ _k8s=$COMMAND_OUTPUT
470+ fi
471+
533472 local repo=" /etc/yum.repos.d/kubernetes.repo"
534- local base=" https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$ basearch"
535- local yumkey=" https://packages.cloud.google.com/yum/doc/yum-key.gpg"
536- local rpmkey=" https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
537473
538474 cat << EOF |
539475[kubernetes]
540476name=Kubernetes
541- baseurl=$base
477+ baseurl=https://pkgs.k8s.io/core:/stable:/v $_k8s /rpm/
542478enabled=1
543479gpgcheck=1
544- repo_gpgcheck=1
545- gpgkey=$yumkey $rpmkey
480+ gpgkey=https://pkgs.k8s.io/core:/stable:/v$_k8s /rpm/repodata/repomd.xml.key
546481EOF
547482 vm-pipe-to-file $repo
548483
552487 k8sverparam=" "
553488 fi
554489
555- vm-command ' grep -iq centos-[78] /etc/os-release' && \
556- vm-command " sed -i 's/gpgcheck=1/gpgcheck=0/g' $repo "
557-
558490 distro-install-pkg iproute-tc kubelet$k8sverparam kubeadm$k8sverparam kubectl$k8sverparam
559491 vm-command " systemctl enable --now kubelet" ||
560492 command-error " failed to enable kubelet"
@@ -612,10 +544,6 @@ fedora-set-kernel-cmdline() {
612544 }
613545}
614546
615- fedora-33-install-crio-pre () {
616- fedora-install-crio-version 1.20
617- }
618-
619547# ##########################################################################
620548
621549#
@@ -678,11 +606,11 @@ sles-install-utils() {
678606}
679607
680608opensuse-image-url () {
681- opensuse-15_4 -image-url
609+ opensuse-15_5 -image-url
682610}
683611
684- opensuse-15_4 -image-url () {
685- echo " https://download.opensuse.org/pub/opensuse/distribution/leap/15.4 /appliances/openSUSE-Leap-15.4 -Minimal-VM.x86_64-OpenStack -Cloud.qcow2"
612+ opensuse-15_5 -image-url () {
613+ echo " https://download.opensuse.org/pub/opensuse/distribution/leap/15.5 /appliances/openSUSE-Leap-15.5 -Minimal-VM.x86_64-Cloud.qcow2"
686614}
687615
688616opensuse-15_5-image-url () {
@@ -778,80 +706,17 @@ opensuse-wait-for-zypper() {
778706 error " Failed to stop zypper running in the background"
779707}
780708
781- opensuse-require-repo-virtualization-containers () {
782- vm-command " zypper ls"
783- if ! grep -q Virtualization_containers <<< " $COMMAND_OUTPUT" ; then
784- vm-command ' source /etc/os-release; echo $VERSION'
785- local opensuse_version=$COMMAND_OUTPUT
786- opensuse-install-repo https://download.opensuse.org/repositories/Virtualization:containers/${opensuse_version} /Virtualization:containers.repo
787- opensuse-refresh-pkg-db
788- fi
789- }
790-
791- opensuse-install-crio-pre () {
792- opensuse-require-repo-virtualization-containers
793- distro-install-pkg --from Virtualization_containers runc conmon
794- vm-command " ln -sf /usr/lib64/libdevmapper.so.1.02 /usr/lib64/libdevmapper.so.1.02.1" || true
795- }
796-
797- opensuse-install-runc () {
798- opensuse-require-repo-virtualization-containers
799- distro-install-pkg --from Virtualization_containers runc
800- }
801-
802- opensuse-install-containerd () {
803- opensuse-require-repo-virtualization-containers
804- distro-install-pkg --from Virtualization_containers containerd containerd-ctr
805- vm-command " ln -sf /usr/sbin/containerd-ctr /usr/sbin/ctr"
806-
807- cat << EOF |
808- [Unit]
809- Description=containerd container runtime
810- Documentation=https://containerd.io
811- After=network.target
812-
813- [Service]
814- ExecStartPre=-/sbin/modprobe overlay
815- ExecStart=/usr/sbin/containerd
816-
817- Delegate=yes
818- KillMode=process
819- Restart=always
820- LimitNPROC=infinity
821- LimitCORE=infinity
822- LimitNOFILE=1048576
823- TasksMax=infinity
824-
825- [Install]
826- WantedBy=multi-user.target
827- EOF
828- vm-pipe-to-file /etc/systemd/system/containerd.service
829-
830- cat << EOF |
831- disabled_plugins = []
832- EOF
833- vm-pipe-to-file /etc/containerd/config.toml
834- vm-command " systemctl daemon-reload" ||
835- command-error " failed to reload systemd daemon"
836- }
837-
838709opensuse-install-k8s () {
839710 vm-command " ( lsmod | grep -q br_netfilter ) || { echo br_netfilter > /etc/modules-load.d/50-br_netfilter.conf; modprobe br_netfilter; }"
840711 vm-command " echo 1 > /proc/sys/net/ipv4/ip_forward"
841712 vm-command " zypper ls"
842713 if ! grep -q snappy <<< " $COMMAND_OUTPUT" ; then
843- distro-install-repo " http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.4 snappy"
714+ distro-install-repo " http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.5 snappy"
844715 distro-refresh-pkg-db
845716 fi
846- distro-install-pkg " snapd apparmor-profiles socat ebtables cri-tools conntrackd iptables ethtool"
847- vm-install-containernetworking
848- # In some snap packages snap-seccomp launching fails on bad path:
849- # cannot obtain snap-seccomp version information: fork/exec /usr/libexec/snapd/snap-seccomp: no such file or directory
850- # But snap-seccomp may be installed to /usr/lib/snapd/snap-seccomp.
851- # (Found in opensuse-tumbleweed/20210921.)
852- # Workaround this problem by making sure that /usr/libexec/snapd/snap-seccomp is found.
853- vm-command-q " [ ! -d /usr/libexec/snapd ] && [ -f /usr/lib/snapd/snap-seccomp ]" &&
854- vm-command " ln -s /usr/lib/snapd /usr/libexec/snapd"
717+ distro-install-pkg " snapd apparmor-profiles socat ebtables conntrackd iptables ethtool cni-plugins"
718+ distro-install-crictl
719+ vm-command " mkdir -p /opt/cni && ln -fs /usr/lib/cni/ -T /opt/cni/bin"
855720
856721 vm-command " systemctl enable --now snapd"
857722 vm-command " snap wait system seed.loaded"
0 commit comments