From 204c4f1cb011025458d8ac1bf11723b357f82c42 Mon Sep 17 00:00:00 2001 From: Jan Gutter Date: Sat, 24 Aug 2024 09:48:11 +0100 Subject: [PATCH] Kicbase: update cri-o packaging sources * cri-o packages have moved to pkgs.k8s.io: https://kubernetes.io/blog/2023/10/10/cri-o-community-package-infrastructure/ * The new packaging format depends on some k8s distro packages. This makes the assumption that the most recent stable k8s is expected to work with the most recent stable cri-o. * Since cri-o is also installed in the Kicbase/ISO via a different method, further work might still be needed for that case: https://github.com/kubernetes/minikube/issues/18359 --- Makefile | 6 ++-- deploy/kicbase/Dockerfile | 29 ++++++++----------- .../update_kubernetes_version.go | 5 ++++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 6bb4eb9023eb..0dd6aa59711e 100644 --- a/Makefile +++ b/Makefile @@ -733,7 +733,7 @@ build-and-upload-cri-dockerd-binaries: .PHONY: local-kicbase local-kicbase: ## Builds the kicbase image and tags it local/kicbase:latest and local/kicbase:$(KIC_VERSION)-$(COMMIT_SHORT) touch deploy/kicbase/CHANGELOG - docker build -f ./deploy/kicbase/Dockerfile -t local/kicbase:$(KIC_VERSION) --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) --cache-from $(KICBASE_IMAGE_GCR) . + docker build -f ./deploy/kicbase/Dockerfile -t local/kicbase:$(KIC_VERSION) --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) --build-arg KUBERNETES_VERSION=$(KUBERNETES_VERSION) --cache-from $(KICBASE_IMAGE_GCR) . docker tag local/kicbase:$(KIC_VERSION) local/kicbase:latest docker tag local/kicbase:$(KIC_VERSION) local/kicbase:$(KIC_VERSION)-$(COMMIT_SHORT) @@ -744,7 +744,7 @@ local-kicbase-debug: local-kicbase ## Builds a local kicbase image and switches .PHONY: build-kic-base-image build-kic-base-image: docker-multi-arch-build ## Build multi-arch local/kicbase:latest - docker buildx build -f ./deploy/kicbase/Dockerfile --platform $(KICBASE_ARCH) $(addprefix -t ,$(KICBASE_IMAGE_REGISTRIES)) --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) . + docker buildx build -f ./deploy/kicbase/Dockerfile --platform $(KICBASE_ARCH) $(addprefix -t ,$(KICBASE_IMAGE_REGISTRIES)) --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) --build-arg KUBERNETES_VERSION=$(KUBERNETES_VERSION) . .PHONY: push-kic-base-image push-kic-base-image: docker-multi-arch-build ## Push multi-arch local/kicbase:latest to all remote registries @@ -759,7 +759,7 @@ ifndef CIBUILD $(call user_confirm, 'Are you sure you want to push $(KICBASE_IMAGE_REGISTRIES) ?') endif ./deploy/kicbase/build_auto_pause.sh $(KICBASE_ARCH) - docker buildx build -f ./deploy/kicbase/Dockerfile --platform $(KICBASE_ARCH) $(addprefix -t ,$(KICBASE_IMAGE_REGISTRIES)) --push --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) --build-arg PREBUILT_AUTO_PAUSE=true . + docker buildx build -f ./deploy/kicbase/Dockerfile --platform $(KICBASE_ARCH) $(addprefix -t ,$(KICBASE_IMAGE_REGISTRIES)) --push --build-arg VERSION_JSON=$(VERSION_JSON) --build-arg COMMIT_SHA=${VERSION}-$(COMMIT_NOQUOTES) --build-arg KUBERNETES_VERSION=$(KUBERNETES_VERSION) --build-arg PREBUILT_AUTO_PAUSE=true . out/preload-tool: go build -ldflags="$(MINIKUBE_LDFLAGS)" -o $@ ./hack/preload-images/*.go diff --git a/deploy/kicbase/Dockerfile b/deploy/kicbase/Dockerfile index 5834d5ecb8aa..294f8d93b73c 100644 --- a/deploy/kicbase/Dockerfile +++ b/deploy/kicbase/Dockerfile @@ -42,7 +42,10 @@ RUN if [ "$PREBUILT_AUTO_PAUSE" != "true" ]; then cd ./cmd/auto-pause/ && go bui FROM ${UBUNTU_JAMMY_IMAGE} as kicbase ARG BUILDKIT_VERSION="v0.15.2" -ARG CRIO_VERSION="1.24" +# cri-o depends on some kubernetes packages, the latest stable series +# is a reasonable choice. +ARG KUBERNETES_VERSION="v1.31.0" +ARG CRIO_VERSION="v1.30" ARG CRI_DOCKERD_VERSION="v0.3.15" ARG CRI_DOCKERD_COMMIT="c1c566e0cc84abe6972f0bf857ecd8fe306258d9" ARG CNI_PLUGINS_VERSION="v1.4.0" @@ -187,17 +190,6 @@ RUN clean-install podman && \ echo "d /run/podman 0770 root podman" > /etc/tmpfiles.d/podman.conf && \ systemd-tmpfiles --create -# install cri-o dependencies: -RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/') && \ - sh -c "echo 'deb https://downloadcontent.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \ - curl -LO https://downloadcontent.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_22.04/Release.key && \ - apt-key add - < Release.key && \ - if [ "$ARCH" != "ppc64le" ]; then \ - clean-install catatonit conmon cri-tools crun; \ - else \ - clean-install conmon crun; \ - fi - # install containernetworking-plugins RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/armhf/arm/') && \ curl -LO "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-$ARCH-${CNI_PLUGINS_VERSION}.tgz" && \ @@ -205,12 +197,15 @@ RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/ tar -xf "cni-plugins-linux-$ARCH-${CNI_PLUGINS_VERSION}.tgz" -C /opt/cni/bin && \ rm "cni-plugins-linux-$ARCH-${CNI_PLUGINS_VERSION}.tgz" -# install cri-o based on https://github.com/cri-o/cri-o/blob/release-1.24/README.md#installing-cri-o +# install cri-o based on https://github.com/cri-o/packaging RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/armhf/arm-v7/') && \ - if [ "$ARCH" != "ppc64le" ] && [ "$ARCH" != "arm-v7" ]; then sh -c "echo 'deb https://downloadcontent.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${CRIO_VERSION}/xUbuntu_22.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:${CRIO_VERSION}.list" && \ - curl -LO https://downloadcontent.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${CRIO_VERSION}/xUbuntu_22.04/Release.key && \ - apt-key add - < Release.key && \ - clean-install cri-o cri-o-runc; fi + export KUBERNETES_RELEASE=$(echo $KUBERNETES_VERSION | grep -oE '[^.]+\.[^.]+') && \ + if [ "$ARCH" != "ppc64le" ] && [ "$ARCH" != "arm-v7" ]; then \ + sh -c "curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBERNETES_RELEASE/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg" && \ + sh -c "echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBERNETES_RELEASE/deb/ /' > /etc/apt/sources.list.d/pkgs.k8s.io:core:stable.list" && \ + sh -c "curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/stable:/$CRIO_VERSION/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg" && \ + sh -c "echo 'deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://pkgs.k8s.io/addons:/cri-o:/stable:/$CRIO_VERSION/deb/ /' > /etc/apt/sources.list.d/pkgs.k8s.io:addons:cri-o:stable.list" && \ + clean-install dbus cri-o cri-tools crun conmon catatonit; fi # install NVIDIA container toolkit RUN export ARCH=$(dpkg --print-architecture) && \ diff --git a/hack/update/kubernetes_version/update_kubernetes_version.go b/hack/update/kubernetes_version/update_kubernetes_version.go index f8b7b54269b3..aa55a523c0fa 100644 --- a/hack/update/kubernetes_version/update_kubernetes_version.go +++ b/hack/update/kubernetes_version/update_kubernetes_version.go @@ -101,6 +101,11 @@ var ( `kubernetesVersion:.*`: `kubernetesVersion: {{.LatestVersionP0}}`, }, }, + "deploy/kicbase/Dockerfile": { + Replace: map[string]string{ + `ARG KUBERNETES_VERSION=.*`: `ARG KUBERNETES_VERSION="{{.StableVersion}}"`, + }, + }, } )