diff --git a/Makefile b/Makefile index eaabc194c..65daeda00 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ GO_FMT := gofmt GO_CYCLO := gocyclo GO_LINT := golint GO_CILINT := golangci-lint -GO_VERSION ?= 1.21.5 +GO_VERSION ?= 1.22.6 GOLICENSES_VERSION ?= v1.5.0 # TEST_TAGS is the set of extra build tags passed for tests. @@ -240,7 +240,7 @@ DIST_TRANSFORM := \ DISTRO_ID := $(shell . /etc/os-release; echo "$${ID:-unknown}") DISTRO_VERSION := $(shell . /etc/os-release; echo "$${VERSION_ID:-unknown}") DISTRO_PACKAGE := $(shell echo $(DISTRO_ID) | tr -d ' \t' | \ - sed -E 's/.*((centos)|(fedora)|(suse)).*/rpm/;s/.*((ubuntu)|(debian)).*/deb/') + sed -E 's/.*((fedora)|(suse)).*/rpm/;s/.*((ubuntu)|(debian)).*/deb/') # Be quiet by default but let folks override it with Q= or V=1 on the command line. ifneq ($(V),1) @@ -684,7 +684,7 @@ cross-tar cross-tarball: dist docker/cross-build/fedora -v $$(pwd)/$$builddir:/build \ -v $$(pwd)/$$outdir:/output \ -v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \ - centos-7-build /bin/bash -c '$(DOCKER_TAR_BUILD)' && \ + fedora-build /bin/bash -c '$(DOCKER_TAR_BUILD)' && \ rm -fr $$builddir && \ install -D -m644 -t $(PACKAGES_DIR)/release-assets $$outdir/cri-resource-manager-$(TAR_VERSION).x86_64.tar.gz diff --git a/cmd/cri-resmgr-agent/Dockerfile b/cmd/cri-resmgr-agent/Dockerfile index e6fe546f9..57c5b92c2 100644 --- a/cmd/cri-resmgr-agent/Dockerfile +++ b/cmd/cri-resmgr-agent/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.22 FROM golang:${GO_VERSION}-bullseye as builder diff --git a/cmd/cri-resmgr-webhook/Dockerfile b/cmd/cri-resmgr-webhook/Dockerfile index 9aafc50ba..4ab2d6372 100644 --- a/cmd/cri-resmgr-webhook/Dockerfile +++ b/cmd/cri-resmgr-webhook/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.22 FROM golang:${GO_VERSION}-bullseye as builder diff --git a/demo/lib/distro.bash b/demo/lib/distro.bash index ece97972f..a6751778b 100644 --- a/demo/lib/distro.bash +++ b/demo/lib/distro.bash @@ -1,6 +1,6 @@ # shellcheck disable=SC2120 GO_URLDIR=https://golang.org/dl -GO_VERSION=1.19.1 +GO_VERSION=1.22.6 GOLANG_URL=$GO_URLDIR/go$GO_VERSION.linux-amd64.tar.gz CRICTL_VERSION=${CRICTL_VERSION:-"v1.25.0"} MINIKUBE_VERSION=${MINIKUBE_VERSION:-v1.27.0} @@ -87,7 +87,6 @@ distro-resolve-fn() { candidates="${VM_DISTRO/./_}-$apifn ${VM_DISTRO%%-*}-$apifn" case $VM_DISTRO in ubuntu*) candidates="$candidates debian-$apifn";; - centos*) candidates="$candidates fedora-$apifn rpm-$apifn";; fedora*) candidates="$candidates rpm-$apifn";; *suse*) candidates="$candidates rpm-$apifn";; sles*) candidates="$candidates opensuse-$apifn rpm-$apifn";; @@ -114,7 +113,7 @@ distro-unresolved() { ########################################################################### # -# Ubuntu 18.04, 20.04, Debian 10, generic debian +# Ubuntu, Debian # ubuntu-18_04-image-url() { @@ -129,6 +128,10 @@ ubuntu-22_04-image-url() { echo "https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64.img" } +ubuntu-24_04-image-url() { + echo "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img" +} + debian-10-image-url() { echo "https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-amd64.qcow2" } @@ -277,17 +280,28 @@ debian-install-crio-pre() { } debian-install-k8s() { - local k8sverparam + local _k8s=$k8s debian-refresh-pkg-db - debian-install-pkg apt-transport-https curl - debian-install-repo-key "https://packages.cloud.google.com/apt/doc/apt-key.gpg" - debian-install-repo "deb https://apt.kubernetes.io/ kubernetes-xenial main" - if [ -n "$k8s" ]; then - k8sverparam="=${k8s}-00" + debian-install-pkg gpg apt-transport-https curl + + if [[ -z "$k8s" ]] || [[ "$k8s" == "latest" ]]; then + 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'" + _k8s=$COMMAND_OUTPUT + fi + echo "installing Kubernetes v${_k8s}" + vm-command "curl -fsSL https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/Release.key -o /tmp/Release.key" || \ + command-error "failed to download Kubernetes v${_k8s} key" + + if vm-command "command -v apt-key >/dev/null"; then + vm-command "sudo apt-key add /tmp/Release.key" + vm-command "echo 'deb https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \ + command-error "failed to add Kubernetes v${_k8s} repo" else - k8sverparam="" + vm-command "sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg /tmp/Release.key" + 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" || \ + command-error "failed to add Kubernetes v${_k8s} repo" fi - debian-install-pkg "kubeadm$k8sverparam" "kubelet$k8sverparam" "kubectl$k8sverparam" + debian-install-pkg "kubeadm" "kubelet" "kubectl" } debian-set-kernel-cmdline() { @@ -304,106 +318,25 @@ debian-env-file-dir() { echo "/etc/default" } +debian-sid-govm-env() { + echo "DISABLE_VGA=N" +} + ########################################################################### # -# Centos 7, 8, generic Fedora +# Generic Fedora # YUM_INSTALL="yum install --disableplugin=fastestmirror -y" YUM_REMOVE="yum remove --disableplugin=fastestmirror -y" -centos-7-image-url() { - echo "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2003.qcow2.xz" -} - -centos-8-image-url() { - echo "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2" -} - -centos-ssh-user() { - echo centos -} - -centos-7-install-utils() { - distro-install-pkg /usr/bin/killall -} - -centos-7-install-repo() { - vm-command-q "type -t yum-config-manager >&/dev/null" || { - distro-install-pkg yum-utils - } - vm-command "yum-config-manager --add-repo $*" || - command-error "failed to add YUM repository $*" -} - -centos-7-install-pkg() { - vm-command "$YUM_INSTALL $*" || - command-error "failed to install $*" -} - -centos-7-remove-pkg() { - vm-command "$YUM_REMOVE $*" || - command-error "failed to remove package(s) $*" -} - -centos-7-install-containerd-pre() { - create-ext4-var-lib-containerd - distro-install-repo https://download.docker.com/linux/centos/docker-ce.repo -} - -centos-8-install-pkg-pre() { - vm-command "[ -f /etc/yum.repos.d/.fixup ]" && return 0 - vm-command 'sed -i "s/mirrorlist/#mirrorlist/g" /etc/yum.repos.d/CentOS-*' && \ - vm-command 'sed -i "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*' && \ - vm-command 'touch /etc/yum.repos.d/.fixup' -} - -centos-8-install-crio-pre() { - if [ -z "$crio_src" ]; then - local os=CentOS_8 - local version=${crio_version:-1.20} - 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" - 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" - fi -} - -centos-8-install-crio() { - if [ -n "$crio_src" ]; then - default-install-crio - else - distro-install-pkg cri-o - vm-command "systemctl enable crio" - fi -} - -centos-8-install-containerd-pre() { - distro-install-repo https://download.docker.com/linux/centos/docker-ce.repo -} - -centos-install-golang() { - distro-install-pkg wget tar gzip git-core - from-tarball-install-golang -} - fedora-image-url() { - fedora-38-image-url + fedora-40-image-url } -fedora-38-image-url() { - echo "https://mirrors.xtom.de/fedora/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.qcow2" -} - -fedora-35-image-url() { - echo "https://mirrors.xtom.de/fedora/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2" -} - -fedora-34-image-url() { - echo "https://mirrors.xtom.de/fedora/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2" -} - -fedora-33-image-url() { - echo "https://mirrors.xtom.de/fedora/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2" +fedora-40-image-url() { + echo "https://mirrors.xtom.de/fedora/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2" } fedora-ssh-user() { @@ -468,7 +401,7 @@ fedora-install-kernel-dev() { fedpkg clone -a kernel cd kernel git fetch - git switch ${VM_DISTRO/edora-/} # example: git switch f35 in fedora-35 + git switch ${VM_DISTRO/edora-/} # example: git switch f40 in fedora-40 sed -i 's/# define buildid .local/%define buildid .e2e/g' kernel.spec )" || { echo "installing kernel development environment failed" @@ -530,19 +463,21 @@ fedora-install-containerd-post() { } fedora-install-k8s() { + _k8s=$k8s + if [[ -z "$_k8s" ]] || [[ "$_k8s" == "latest" ]]; then + 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'" + _k8s=$COMMAND_OUTPUT + fi + local repo="/etc/yum.repos.d/kubernetes.repo" - local base="https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch" - local yumkey="https://packages.cloud.google.com/yum/doc/yum-key.gpg" - local rpmkey="https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" cat < /etc/modules-load.d/50-br_netfilter.conf; modprobe br_netfilter; }" vm-command "echo 1 > /proc/sys/net/ipv4/ip_forward" vm-command "zypper ls" if ! grep -q snappy <<< "$COMMAND_OUTPUT"; then - distro-install-repo "http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.4 snappy" + distro-install-repo "http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.5 snappy" distro-refresh-pkg-db fi - distro-install-pkg "snapd apparmor-profiles socat ebtables cri-tools conntrackd iptables ethtool" - vm-install-containernetworking - # In some snap packages snap-seccomp launching fails on bad path: - # cannot obtain snap-seccomp version information: fork/exec /usr/libexec/snapd/snap-seccomp: no such file or directory - # But snap-seccomp may be installed to /usr/lib/snapd/snap-seccomp. - # (Found in opensuse-tumbleweed/20210921.) - # Workaround this problem by making sure that /usr/libexec/snapd/snap-seccomp is found. - vm-command-q "[ ! -d /usr/libexec/snapd ] && [ -f /usr/lib/snapd/snap-seccomp ]" && - vm-command "ln -s /usr/lib/snapd /usr/libexec/snapd" + distro-install-pkg "snapd apparmor-profiles socat ebtables conntrackd iptables ethtool cni-plugins" + distro-install-crictl + vm-command "mkdir -p /opt/cni && ln -fs /usr/lib/cni/ -T /opt/cni/bin" vm-command "systemctl enable --now snapd" vm-command "snap wait system seed.loaded" diff --git a/demo/lib/host.bash b/demo/lib/host.bash index ddc2ba4a2..5f1f0622c 100644 --- a/demo/lib/host.bash +++ b/demo/lib/host.bash @@ -266,7 +266,10 @@ host-wait-vm-ssh-server() { host-wait-cloud-init() { retries=60 retries_left=$retries - while ! $SSH -o ConnectTimeout=2 ${VM_SSH_USER}@${VM_IP} sudo cloud-init status --wait 2>/dev/null; do + while true; do + $SSH -o ConnectTimeout=2 ${VM_SSH_USER}@${VM_IP} sudo cloud-init status --wait 2>/dev/null + [ "$?" -eq 0 -o "$?" -eq 2 ] && break + if [ "$retries" == "$retries_left" ]; then echo -n "Waiting for VM cloud-init to finish..." fi diff --git a/demo/lib/vm.bash b/demo/lib/vm.bash index 4e900c62b..93668279e 100644 --- a/demo/lib/vm.bash +++ b/demo/lib/vm.bash @@ -655,6 +655,7 @@ vm-install-cri-resmgr() { elif [[ "$pkg_count" -gt 1 ]]; then error "installing from $binsrc failed: expected exactly one cri-resource-manager*.$suf in $HOST_PROJECT_DIR/$binsrc, found $pkg_count alternatives." fi + vm-command "mkdir -p /etc/cri-resmgr && touch /etc/cri-resmgr/fallback.cfg" host-command "$SCP $HOST_PROJECT_DIR/$binsrc/*.$suf $VM_SSH_USER@$VM_IP:/tmp" || { command-error "copying *.$suf to vm failed, run \"make cross-$suf\" first" } diff --git a/dockerfiles/cross-build/Dockerfile.centos-7 b/dockerfiles/cross-build/Dockerfile.centos-7 deleted file mode 100644 index 1342d27c2..000000000 --- a/dockerfiles/cross-build/Dockerfile.centos-7 +++ /dev/null @@ -1,32 +0,0 @@ -# pull in base + a minimal set of useful packages -FROM centos:7 as centos-7-build - -ARG GO_VERSION=x.yz -ARG GOLICENSES_VERSION -ARG GIT_VERSION=2.27.0 -ARG GIT_URLDIR=https://github.com/git/git/archive -ARG CREATE_USER="build" -ARG USER_OPTIONS="" -ENV PATH /go/bin:/usr/local/go/bin:$PATH - -RUN yum install -y --nogpgcheck rpm-build \ - kernel-devel gcc \ - curl-devel zlib-devel openssl-devel expat-devel \ - make wget - -# fetch and build a recent git from sources, anything below 1.9.5 is known to not work for us -RUN mkdir /git && cd /git && wget $GIT_URLDIR/v$GIT_VERSION.tar.gz && \ - tar -xvzf v$GIT_VERSION.tar.gz && cd git-$GIT_VERSION && \ - make -j8 NO_TCLTK=1 NO_GETTEXT=1 prefix=/usr all && \ - yum remove -y git && \ - make -j8 NO_TCLTK=1 NO_GETTEXT=1 prefix=/usr install - -ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / - -RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ - rm /go${GO_VERSION}.linux-amd64.tar.gz - -RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} - -RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS diff --git a/dockerfiles/cross-build/Dockerfile.centos-8 b/dockerfiles/cross-build/Dockerfile.centos-8 deleted file mode 100644 index b3fdd1e96..000000000 --- a/dockerfiles/cross-build/Dockerfile.centos-8 +++ /dev/null @@ -1,25 +0,0 @@ -# pull in base + a minimal set of useful packages -FROM centos:8 as centos-8-build - -ARG GO_VERSION=x.yz -ARG GOLICENSES_VERSION -ARG CREATE_USER="build" -ARG USER_OPTIONS="" -ENV PATH /go/bin:/usr/local/go/bin:$PATH - -RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \ - sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - -RUN dnf install -y rpm-build \ - kernel-devel gcc \ - git-core make - -ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / - -RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ - rm /go${GO_VERSION}.linux-amd64.tar.gz - -RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} - -RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS diff --git a/dockerfiles/cross-build/Dockerfile.debian-10 b/dockerfiles/cross-build/Dockerfile.debian-10 index 16ff5cd59..3efdb7d3e 100644 --- a/dockerfiles/cross-build/Dockerfile.debian-10 +++ b/dockerfiles/cross-build/Dockerfile.debian-10 @@ -4,7 +4,7 @@ FROM debian:buster as debian-10-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="test" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH # pull in stuff for cgo @@ -22,4 +22,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.debian-sid b/dockerfiles/cross-build/Dockerfile.debian-sid index fa6f9acec..c858caca7 100644 --- a/dockerfiles/cross-build/Dockerfile.debian-sid +++ b/dockerfiles/cross-build/Dockerfile.debian-sid @@ -4,7 +4,7 @@ FROM debian:sid as debian-sid-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="test" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH # pull in stuff for cgo @@ -22,4 +22,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.fedora b/dockerfiles/cross-build/Dockerfile.fedora index 11c5d59dc..18972875d 100644 --- a/dockerfiles/cross-build/Dockerfile.fedora +++ b/dockerfiles/cross-build/Dockerfile.fedora @@ -4,7 +4,7 @@ FROM fedora:latest as fedora-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="build" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN dnf install -y rpm-build systemd-rpm-macros \ @@ -19,4 +19,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 b/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.5 similarity index 82% rename from dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 rename to dockerfiles/cross-build/Dockerfile.opensuse-leap-15.5 index f899da889..06dbe2820 100644 --- a/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 +++ b/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.5 @@ -1,10 +1,10 @@ # pull in base + a minimal set of useful packages -FROM opensuse/leap:15.4 as suse-15.4-build +FROM opensuse/leap:15.5 as suse-15.5-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="build" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN zypper install -y rpm-build \ @@ -19,4 +19,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 index af9412f55..29809171a 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 @@ -4,7 +4,7 @@ FROM ubuntu:18.04 as ubuntu-18.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="test" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH # pull in stuff for cgo @@ -22,4 +22,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 index 8c844df6f..c92ab5141 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 @@ -4,7 +4,7 @@ FROM ubuntu:20.04 as ubuntu-20.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="test" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH ENV DEBIAN_FRONTEND noninteractive @@ -23,4 +23,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 index cb6166bd9..3576dbf1c 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 @@ -4,7 +4,7 @@ FROM ubuntu:22.04 as ubuntu-22.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION ARG CREATE_USER="test" -ARG USER_OPTIONS="" +ARG USER_UID="" ENV PATH /go/bin:/usr/local/go/bin:$PATH ENV DEBIAN_FRONTEND noninteractive @@ -23,4 +23,4 @@ RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ - useradd -m -s /bin/bash $CREATE_USER $USER_OPTIONS + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-24.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-24.04 new file mode 100644 index 000000000..f5b68e19b --- /dev/null +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-24.04 @@ -0,0 +1,30 @@ +# pull in base + a minimal set of useful packages +FROM ubuntu:24.04 as ubuntu-24.04-build + +ARG GO_VERSION=x.yz +ARG GOLICENSES_VERSION +ARG CREATE_USER="test" +ARG USER_UID="" +ENV PATH /go/bin:/usr/local/go/bin:$PATH +ENV DEBIAN_FRONTEND noninteractive + +# pull in stuff for building +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + tzdata build-essential fakeroot devscripts \ + bash git make sed debhelper ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz + +RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} + +RUN if [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ]; then \ + if getent passwd $USER_UID; then \ + userdel `id -un $USER_UID`; \ + fi; \ + useradd -m -s /bin/bash $CREATE_USER -u $USER_UID; \ + fi diff --git a/docs/installation.md b/docs/installation.md index ced083cd0..729d0d3e1 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -62,8 +62,7 @@ make cross-$type.$distro-$version Similarly to `make packages`, this will build packages using a `Docker\*` container. However, instead of building for your host, it will build them for the specified distro. For instance `make cross-deb.ubuntu-18.04` will -build `deb` packages for `Ubuntu\* 18.04` and `make cross-rpm.centos-8` will -build `rpm` packages for `CentOS\* 8` +build `deb` packages for `Ubuntu\* 18.04`. ## Post-install configuration diff --git a/docs/quick-start.md b/docs/quick-start.md index 7aa8312c7..99050d8ef 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -14,7 +14,7 @@ First, install and setup cri-resource-manager. ### Install package -#### CentOS\*, Fedora\*, and SUSE\* +#### Fedora\*, and SUSE\* ``` CRIRM_VERSION=`curl -s "https://api.github.com/repos/intel/cri-resource-manager/releases/latest" | \ @@ -57,7 +57,7 @@ When integrating into an existing cluster you need to change kubelet to use cri-resmgr instead of the existing container runtime (expecting containerd here). -#### CentOS, Fedora, and SUSE +#### Fedora, and SUSE ``` sudo sed '/KUBELET_EXTRA_ARGS/ s!$! --container-runtime-endpoint=/var/run/cri-resmgr/cri-resmgr.sock!' -i /etc/sysconfig/kubelet sudo systemctl restart kubelet diff --git a/go.mod b/go.mod index e9470ca04..42d32b255 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/intel/cri-resource-manager -go 1.21 +go 1.22.0 require ( contrib.go.opencensus.io/exporter/jaeger v0.2.1 diff --git a/pkg/topology/go.mod b/pkg/topology/go.mod index caad452ab..3f08129e7 100644 --- a/pkg/topology/go.mod +++ b/pkg/topology/go.mod @@ -1,6 +1,6 @@ module github.com/intel/cri-resource-manager/pkg/topology -go 1.21 +go 1.22.0 require ( github.com/pkg/errors v0.9.1 diff --git a/scripts/build/docker-build-image b/scripts/build/docker-build-image index ba1d643a4..6d5832e96 100755 --- a/scripts/build/docker-build-image +++ b/scripts/build/docker-build-image @@ -12,5 +12,5 @@ echo " - options : $@" docker build . \ -f "$DOCKERFILE" -t "$IMAGE" \ --build-arg "CREATE_USER=$USER" \ - --build-arg USER_OPTIONS="-u $(id -u)" \ + --build-arg USER_UID="$(id -u)" \ "$@" || exit 1 diff --git a/test/e2e/packages.test-suite/centos-7/binsrc.var b/test/e2e/packages.test-suite/centos-7/binsrc.var deleted file mode 100644 index eabfe66fa..000000000 --- a/test/e2e/packages.test-suite/centos-7/binsrc.var +++ /dev/null @@ -1 +0,0 @@ -packages/centos-7 \ No newline at end of file diff --git a/test/e2e/packages.test-suite/centos-7/distro.var b/test/e2e/packages.test-suite/centos-7/distro.var deleted file mode 100644 index 52a1e29d1..000000000 --- a/test/e2e/packages.test-suite/centos-7/distro.var +++ /dev/null @@ -1 +0,0 @@ -centos-7 diff --git a/test/e2e/packages.test-suite/centos-8/binsrc.var b/test/e2e/packages.test-suite/centos-8/binsrc.var deleted file mode 100644 index c2541175a..000000000 --- a/test/e2e/packages.test-suite/centos-8/binsrc.var +++ /dev/null @@ -1 +0,0 @@ -packages/centos-8 \ No newline at end of file diff --git a/test/e2e/packages.test-suite/centos-8/distro.var b/test/e2e/packages.test-suite/centos-8/distro.var deleted file mode 100644 index ef0650a36..000000000 --- a/test/e2e/packages.test-suite/centos-8/distro.var +++ /dev/null @@ -1 +0,0 @@ -centos-8 diff --git a/test/e2e/packages.test-suite/centos-8/pkgtest/test01-systemd/code.var.sh b/test/e2e/packages.test-suite/centos-8/pkgtest/test01-systemd/code.var.sh deleted file mode 100644 index f9036fcbf..000000000 --- a/test/e2e/packages.test-suite/centos-8/pkgtest/test01-systemd/code.var.sh +++ /dev/null @@ -1,14 +0,0 @@ -# Reconfigure journald to allow very verbose logging. -vm-command "sed -i 's/^#RateLimit/RateLimit/g;s/Burst=.*$/Burst=10000/g' /etc/systemd/journald.conf" -vm-command "systemctl restart systemd-journald" - -# Clear cri-resmgr output from previous runs. -vm-command "journalctl --vacuum-time=1s" - -# Create a pod. -create besteffort - -# Verify that new pod was created by systemd-managed cri-resource-manager. -vm-command "journalctl -xeu cri-resource-manager | grep 'StartContainer: starting container pod0:pod0c0'" || { - command-error "failed to verify that systemd-managed cri-resource-manager launched the pod" -} diff --git a/test/e2e/packages.test-suite/opensuse-15.4/binsrc.var b/test/e2e/packages.test-suite/opensuse-15.4/binsrc.var deleted file mode 100644 index 7e148e86e..000000000 --- a/test/e2e/packages.test-suite/opensuse-15.4/binsrc.var +++ /dev/null @@ -1 +0,0 @@ -packages/opensuse-leap-15.4 diff --git a/test/e2e/packages.test-suite/opensuse-15.4/cri-resmgr.cfg b/test/e2e/packages.test-suite/opensuse-15.4/cri-resmgr.cfg deleted file mode 100644 index c5a769e5d..000000000 --- a/test/e2e/packages.test-suite/opensuse-15.4/cri-resmgr.cfg +++ /dev/null @@ -1,6 +0,0 @@ -policy: - Active: topology-aware - ReservedResources: - CPU: 750m -logger: - Debug: cri-resmgr,resource-manager,cache,policy diff --git a/test/e2e/packages.test-suite/opensuse-15.4/distro.var b/test/e2e/packages.test-suite/opensuse-15.4/distro.var deleted file mode 100644 index 8b203119f..000000000 --- a/test/e2e/packages.test-suite/opensuse-15.4/distro.var +++ /dev/null @@ -1 +0,0 @@ -opensuse-15.4 diff --git a/test/e2e/packages.test-suite/opensuse-15.4/pkgtest/topology.var.json b/test/e2e/packages.test-suite/opensuse-15.4/pkgtest/topology.var.json deleted file mode 100644 index 2c7928382..000000000 --- a/test/e2e/packages.test-suite/opensuse-15.4/pkgtest/topology.var.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - {"mem": "2G", "cores": 2, "nodes": 2, "packages": 2} -] diff --git a/test/e2e/packages.test-suite/opensuse-15.4/reinstall_cri_resmgr.var b/test/e2e/packages.test-suite/opensuse-15.4/reinstall_cri_resmgr.var deleted file mode 100644 index 56a6051ca..000000000 --- a/test/e2e/packages.test-suite/opensuse-15.4/reinstall_cri_resmgr.var +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/test/e2e/packages.test-suite/opensuse-15.5/binsrc.var b/test/e2e/packages.test-suite/opensuse-15.5/binsrc.var new file mode 100644 index 000000000..d713eecbb --- /dev/null +++ b/test/e2e/packages.test-suite/opensuse-15.5/binsrc.var @@ -0,0 +1 @@ +packages/opensuse-leap-15.5 diff --git a/test/e2e/packages.test-suite/centos-7/cri-resmgr.cfg b/test/e2e/packages.test-suite/opensuse-15.5/cri-resmgr.cfg similarity index 100% rename from test/e2e/packages.test-suite/centos-7/cri-resmgr.cfg rename to test/e2e/packages.test-suite/opensuse-15.5/cri-resmgr.cfg diff --git a/test/e2e/packages.test-suite/opensuse-15.5/distro.var b/test/e2e/packages.test-suite/opensuse-15.5/distro.var new file mode 100644 index 000000000..73972bca8 --- /dev/null +++ b/test/e2e/packages.test-suite/opensuse-15.5/distro.var @@ -0,0 +1 @@ +opensuse-15.5 diff --git a/test/e2e/packages.test-suite/opensuse-15.4/pkgtest/test01-systemd/code.var.sh b/test/e2e/packages.test-suite/opensuse-15.5/pkgtest/test01-systemd/code.var.sh similarity index 100% rename from test/e2e/packages.test-suite/opensuse-15.4/pkgtest/test01-systemd/code.var.sh rename to test/e2e/packages.test-suite/opensuse-15.5/pkgtest/test01-systemd/code.var.sh diff --git a/test/e2e/packages.test-suite/centos-7/pkgtest/topology.var.json b/test/e2e/packages.test-suite/opensuse-15.5/pkgtest/topology.var.json similarity index 100% rename from test/e2e/packages.test-suite/centos-7/pkgtest/topology.var.json rename to test/e2e/packages.test-suite/opensuse-15.5/pkgtest/topology.var.json diff --git a/test/e2e/packages.test-suite/centos-7/reinstall_cri_resmgr.var b/test/e2e/packages.test-suite/opensuse-15.5/reinstall_cri_resmgr.var similarity index 100% rename from test/e2e/packages.test-suite/centos-7/reinstall_cri_resmgr.var rename to test/e2e/packages.test-suite/opensuse-15.5/reinstall_cri_resmgr.var diff --git a/test/e2e/packages.test-suite/ubuntu-24.04/binsrc.var b/test/e2e/packages.test-suite/ubuntu-24.04/binsrc.var new file mode 100644 index 000000000..6b3e665fa --- /dev/null +++ b/test/e2e/packages.test-suite/ubuntu-24.04/binsrc.var @@ -0,0 +1 @@ +packages/ubuntu-24.04 diff --git a/test/e2e/packages.test-suite/centos-8/cri-resmgr.cfg b/test/e2e/packages.test-suite/ubuntu-24.04/cri-resmgr.cfg similarity index 100% rename from test/e2e/packages.test-suite/centos-8/cri-resmgr.cfg rename to test/e2e/packages.test-suite/ubuntu-24.04/cri-resmgr.cfg diff --git a/test/e2e/packages.test-suite/ubuntu-24.04/distro.var b/test/e2e/packages.test-suite/ubuntu-24.04/distro.var new file mode 100644 index 000000000..2c0c1ac72 --- /dev/null +++ b/test/e2e/packages.test-suite/ubuntu-24.04/distro.var @@ -0,0 +1 @@ +ubuntu-24.04 diff --git a/test/e2e/packages.test-suite/centos-7/pkgtest/test01-systemd/code.var.sh b/test/e2e/packages.test-suite/ubuntu-24.04/pkgtest/test01-systemd/code.var.sh similarity index 66% rename from test/e2e/packages.test-suite/centos-7/pkgtest/test01-systemd/code.var.sh rename to test/e2e/packages.test-suite/ubuntu-24.04/pkgtest/test01-systemd/code.var.sh index f9036fcbf..542ea6c05 100644 --- a/test/e2e/packages.test-suite/centos-7/pkgtest/test01-systemd/code.var.sh +++ b/test/e2e/packages.test-suite/ubuntu-24.04/pkgtest/test01-systemd/code.var.sh @@ -1,7 +1,3 @@ -# Reconfigure journald to allow very verbose logging. -vm-command "sed -i 's/^#RateLimit/RateLimit/g;s/Burst=.*$/Burst=10000/g' /etc/systemd/journald.conf" -vm-command "systemctl restart systemd-journald" - # Clear cri-resmgr output from previous runs. vm-command "journalctl --vacuum-time=1s" diff --git a/test/e2e/packages.test-suite/centos-8/pkgtest/topology.var.json b/test/e2e/packages.test-suite/ubuntu-24.04/pkgtest/topology.var.json similarity index 100% rename from test/e2e/packages.test-suite/centos-8/pkgtest/topology.var.json rename to test/e2e/packages.test-suite/ubuntu-24.04/pkgtest/topology.var.json diff --git a/test/e2e/packages.test-suite/centos-8/reinstall_cri_resmgr.var b/test/e2e/packages.test-suite/ubuntu-24.04/reinstall_cri_resmgr.var similarity index 100% rename from test/e2e/packages.test-suite/centos-8/reinstall_cri_resmgr.var rename to test/e2e/packages.test-suite/ubuntu-24.04/reinstall_cri_resmgr.var diff --git a/test/e2e/run.sh b/test/e2e/run.sh index bc234d6e1..073a914c5 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -99,16 +99,16 @@ usage() { echo " topology: JSON to override NUMA node list used in tests." echo " See: python3 ${DEMO_LIB_DIR}/topology2qemuopts.py --help" echo " distro: Linux distribution to be / already installed on vm." - echo " Supported values: centos-7, centos-8, debian-10, debian-sid" - echo " fedora, fedora-33, opensuse-tumbleweed," - echo " opensuse-15.4 (same as opensuse), opensuse-15.5, sles," - echo " ubuntu-18.04, ubuntu-20.04, ubuntu-22.04" + echo " Supported values: debian-10, debian-sid" + echo " fedora, opensuse-tumbleweed," + echo " opensuse-15.5 (same as opensuse), sles," + echo " ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04" echo " If sles: set VM_SLES_REGCODE= to use official packages." echo " cgroups: cgroups version in the VM, v1 or v2. The default is v1." echo " cgroups=v2 is supported only on distro=fedora" echo " k8s: Kubernetes version to be installed on VM creation" echo " The default is the latest available on selected distro." - echo " Example: k8s=1.18.10" + echo " Example: k8s=1.31" echo " k8scri: The container runtime pipe where kubelet connects to." echo " Options are:" echo " \"cri-resmgr|containerd\" cri-resmgr is a proxy to containerd." @@ -153,8 +153,8 @@ usage() { echo "" echo "Default test input VARs: ./run.sh help defaults" echo "" - echo "Create VM 'foo' that runs k8s 1.20.2 on Debian Sid:" - echo "vm=foo distro=debian-sid k8s=1.20.2 ./run.sh interactive" + echo "Create VM 'foo' that runs k8s 1.28 on Debian Sid:" + echo "vm=foo distro=debian-sid k8s=1.28 ./run.sh interactive" } error() { diff --git a/test/e2e/run_all_configurations.sh b/test/e2e/run_all_configurations.sh index 31040a09b..88a2663b4 100755 --- a/test/e2e/run_all_configurations.sh +++ b/test/e2e/run_all_configurations.sh @@ -4,7 +4,7 @@ RUN_SH="${0%/*}/run.sh" PAIRWISE="${0%/*}/../../scripts/testing/pairwise" "${PAIRWISE}" \ - distro={debian-sid,fedora-35,fedora-34,opensuse-tumbleweed} \ + distro={debian-sid,fedora-40,opensuse-tumbleweed} \ k8scri={containerd,crio,cri-resmgr\|containerd,cri-resmgr\|crio} \ k8scni={cilium,flannel,weavenet} | while read -r env_vars; do