Skip to content

Commit

Permalink
Merge pull request #15752 from spowelljr/updateCriDockerd
Browse files Browse the repository at this point in the history
ISO/Kicbase: Update cri-dockerd from 0.3.0 to 0.3.1
  • Loading branch information
spowelljr authored Feb 15, 2023
2 parents 246343b + 197ca21 commit 8d12bf3
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 44 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,9 @@ jobs:
sudo apt-get update -qq
sudo apt-get -qq -y install conntrack
sudo apt-get -qq -y install socat
CRI_DOCKERD_VERSION="0de30fc57b659cf23b1212d6516e0cceab9c91d1"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}"
CRI_DOCKERD_VERSION="v0.3.1"
CRI_DOCKERD_COMMIT="9a87d6ae274ecf0f23776920964d6484bd679282"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}"
sudo curl -L "${CRI_DOCKERD_BASE_URL}/amd64/cri-dockerd" -o /usr/bin/cri-dockerd
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,9 @@ jobs:
sudo apt-get update -qq
sudo apt-get -qq -y install conntrack
sudo apt-get -qq -y install socat
CRI_DOCKERD_VERSION="0de30fc57b659cf23b1212d6516e0cceab9c91d1"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}"
CRI_DOCKERD_VERSION="v0.3.1"
CRI_DOCKERD_COMMIT="9a87d6ae274ecf0f23776920964d6484bd679282"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}"
sudo curl -L "${CRI_DOCKERD_BASE_URL}/amd64/cri-dockerd" -o /usr/bin/cri-dockerd
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ KUBERNETES_VERSION ?= $(shell egrep "DefaultKubernetesVersion =" pkg/minikube/co
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)

# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
ISO_VERSION ?= v1.29.0-1675184411-15728
ISO_VERSION ?= v1.29.0-1676397967-15752

# Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta
DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))
Expand All @@ -45,7 +45,7 @@ KVM_GO_VERSION ?= $(GO_VERSION:.0=)
INSTALL_SIZE ?= $(shell du out/minikube-windows-amd64.exe | cut -f1)
BUILDROOT_BRANCH ?= 2021.02.12
# the go version on the line below is for the ISO and does not need to be updated often
GOLANG_OPTIONS = GO_VERSION=1.20 GO_HASH_FILE=$(PWD)/deploy/iso/minikube-iso/go.hash
GOLANG_OPTIONS = GO_VERSION=1.19.5 GO_HASH_FILE=$(PWD)/deploy/iso/minikube-iso/go.hash
BUILDROOT_OPTIONS = BR2_EXTERNAL=../../deploy/iso/minikube-iso $(GOLANG_OPTIONS)
REGISTRY ?= gcr.io/k8s-minikube

Expand Down Expand Up @@ -713,10 +713,11 @@ KICBASE_IMAGE_HUB ?= kicbase/stable:$(KIC_VERSION)
KICBASE_IMAGE_REGISTRIES ?= $(KICBASE_IMAGE_GCR) $(KICBASE_IMAGE_HUB)

CRI_DOCKERD_VERSION ?= $(shell egrep "CRI_DOCKERD_VERSION=" deploy/kicbase/Dockerfile | cut -d \" -f2)
CRI_DOCKERD_COMMIT ?= $(shell egrep "CRI_DOCKERD_COMMIT=" deploy/kicbase/Dockerfile | cut -d \" -f2)
.PHONY: update-cri-dockerd
update-cri-dockerd:
(cd hack/update/cri_dockerd_version && \
go run update_cri_dockerd_version.go $(CRI_DOCKERD_VERSION) $(KICBASE_ARCH))
go run update_cri_dockerd_version.go $(CRI_DOCKERD_VERSION) $(CRI_DOCKERD_COMMIT) $(KICBASE_ARCH))

.PHONY: local-kicbase
local-kicbase: ## Builds the kicbase image and tags it local/kicbase:latest and local/kicbase:$(KIC_VERSION)-$(COMMIT_SHORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ sha256 b2a082a8846ac74b8482ee6353d480cea0dec017bbec2b59b16e3f91efa2f5ca eb0c48ef
sha256 ceb99430633f75f354c0e9fea1f3cf0e5138ac5ee3c2691a1a70811fd2feeeef a4d1895a2659ea9974bd7528a706592ab8b74181.tar.gz
sha256 cb90ff5fd4de69cc9cf2a63408d42b605f1d4e70b92012729c0a3bd9a4cfa197 0737013d3c48992724283d151e8a2a767a1839e9.tar.gz
sha256 a2e31a5c8ef122a91c4d4107ba2e0cb4950940f9bbf02ee3020715ba051caef9 0de30fc57b659cf23b1212d6516e0cceab9c91d1.tar.gz
sha256 fc467606256ef13d89365df00a1c4b4b4226628c1a6fd68d2c3fda32bdf36291 9a87d6ae274ecf0f23776920964d6484bd679282.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#
################################################################################

# As of 2023-01-19
CRI_DOCKERD_AARCH64_VER = 0.3.0
CRI_DOCKERD_AARCH64_REV = 0de30fc
CRI_DOCKERD_AARCH64_VERSION = 0de30fc57b659cf23b1212d6516e0cceab9c91d1
CRI_DOCKERD_AARCH64_VER = 0.3.1
CRI_DOCKERD_AARCH64_REV = 9a87d6a
CRI_DOCKERD_AARCH64_VERSION = 9a87d6ae274ecf0f23776920964d6484bd679282
CRI_DOCKERD_AARCH64_SITE = https://github.com/Mirantis/cri-dockerd/archive
CRI_DOCKERD_AARCH64_SOURCE = $(CRI_DOCKERD_AARCH64_VERSION).tar.gz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ sha256 b2a082a8846ac74b8482ee6353d480cea0dec017bbec2b59b16e3f91efa2f5ca eb0c48ef
sha256 ceb99430633f75f354c0e9fea1f3cf0e5138ac5ee3c2691a1a70811fd2feeeef a4d1895a2659ea9974bd7528a706592ab8b74181.tar.gz
sha256 cb90ff5fd4de69cc9cf2a63408d42b605f1d4e70b92012729c0a3bd9a4cfa197 0737013d3c48992724283d151e8a2a767a1839e9.tar.gz
sha256 a2e31a5c8ef122a91c4d4107ba2e0cb4950940f9bbf02ee3020715ba051caef9 0de30fc57b659cf23b1212d6516e0cceab9c91d1.tar.gz
sha256 fc467606256ef13d89365df00a1c4b4b4226628c1a6fd68d2c3fda32bdf36291 9a87d6ae274ecf0f23776920964d6484bd679282.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#
################################################################################

# As of 2023-01-19
CRI_DOCKERD_VER = 0.3.0
CRI_DOCKERD_REV = 0de30fc
CRI_DOCKERD_VERSION = 0de30fc57b659cf23b1212d6516e0cceab9c91d1
CRI_DOCKERD_VER = 0.3.1
CRI_DOCKERD_REV = 9a87d6a
CRI_DOCKERD_VERSION = 9a87d6ae274ecf0f23776920964d6484bd679282
CRI_DOCKERD_SITE = https://github.com/Mirantis/cri-dockerd/archive
CRI_DOCKERD_SOURCE = $(CRI_DOCKERD_VERSION).tar.gz

Expand Down
11 changes: 6 additions & 5 deletions deploy/kicbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ ARG BUILDKIT_VERSION="v0.11.2"
ARG FUSE_OVERLAYFS_VERSION="v1.7.1"
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION="1.0.3"
ARG CRIO_VERSION="1.24"
ARG CRI_DOCKERD_VERSION="0de30fc57b659cf23b1212d6516e0cceab9c91d1"
ARG CRI_DOCKERD_VERSION="v0.3.1"
ARG CRI_DOCKERD_COMMIT="9a87d6ae274ecf0f23776920964d6484bd679282"
ARG TARGETARCH

# copy in static files (configs, scripts)
Expand Down Expand Up @@ -125,10 +126,10 @@ ARG COMMIT_SHA
USER root

# Install cri-dockerd from pre-compiled binaries stored in GCS, this is way faster than building from source in multi-arch
RUN echo "Installing cri-dockerd" && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}/${TARGETARCH}/cri-dockerd" -o /usr/bin/cri-dockerd && chmod +x /usr/bin/cri-dockerd && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service
RUN echo "Installing cri-dockerd ${CRI_DOCKERD_VERSION}" && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}/${TARGETARCH}/cri-dockerd" -o /usr/bin/cri-dockerd && chmod +x /usr/bin/cri-dockerd && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket && \
curl -L "https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service

# install system requirements from the regular distro repositories
RUN clean-install \
Expand Down
5 changes: 3 additions & 2 deletions hack/jenkins/linux_integration_tests_none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ fi
# cri-dockerd is required for Kubernetes 1.24 and higher for none driver
if ! cri-dockerd --version &>/dev/null; then
echo "WARNING: cri-dockerd is not installed. will try to install."
CRI_DOCKERD_VERSION="0de30fc57b659cf23b1212d6516e0cceab9c91d1"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_VERSION}"
CRI_DOCKERD_VERSION="v0.3.1"
CRI_DOCKERD_COMMIT="9a87d6ae274ecf0f23776920964d6484bd679282"
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}"
sudo curl -L "${CRI_DOCKERD_BASE_URL}/amd64/cri-dockerd" -o /usr/bin/cri-dockerd
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service
Expand Down
73 changes: 63 additions & 10 deletions hack/update/cri_dockerd_version/update_cri_dockerd_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,50 @@ limitations under the License.
package main

import (
"crypto/sha256"
"fmt"
"io"
"log"
"net/http"
"os"
"os/exec"
"strings"

"golang.org/x/mod/semver"
"k8s.io/klog/v2"
"k8s.io/minikube/hack/update"
)

var (
schema = map[string]update.Item{
".github/workflows/master.yml": {
Replace: map[string]string{
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="{{.FullCommit}}"`,
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="v{{.Version}}"`,
`CRI_DOCKERD_COMMIT=".*"`: `CRI_DOCKERD_COMMIT="{{.FullCommit}}"`,
},
},
".github/workflows/pr.yml": {
Replace: map[string]string{
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="{{.FullCommit}}"`,
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="v{{.Version}}"`,
`CRI_DOCKERD_COMMIT=".*"`: `CRI_DOCKERD_COMMIT="{{.FullCommit}}"`,
},
},
"hack/jenkins/linux_integration_tests_none.sh": {
Replace: map[string]string{
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="{{.FullCommit}}"`,
`CRI_DOCKERD_VERSION=".*"`: `CRI_DOCKERD_VERSION="v{{.Version}}"`,
`CRI_DOCKERD_COMMIT=".*"`: `CRI_DOCKERD_COMMIT="{{.FullCommit}}"`,
},
},
"deploy/iso/minikube-iso/arch/aarch64/package/cri-dockerd-aarch64/cri-dockerd.mk": {
Replace: map[string]string{
`CRI_DOCKERD_AARCH64_VER = .*`: `CRI_DOCKERD_AARCH64_VER = {{.Version}}`,
`CRI_DOCKERD_AARCH64_VERSION = .*`: `CRI_DOCKERD_AARCH64_VERSION = {{.FullCommit}}`,
`CRI_DOCKERD_AARCH64_REV = .*`: `CRI_DOCKERD_AARCH64_REV = {{.ShortCommit}}`,
},
},
"deploy/iso/minikube-iso/arch/x86_64/package/cri-dockerd/cri-dockerd.mk": {
Replace: map[string]string{
`CRI_DOCKERD_VER = .*`: `CRI_DOCKERD_VER = {{.Version}}`,
`CRI_DOCKERD_VERSION = .*`: `CRI_DOCKERD_VERSION = {{.FullCommit}}`,
`CRI_DOCKERD_REV = .*`: `CRI_DOCKERD_REV = {{.ShortCommit}}`,
},
Expand All @@ -59,25 +70,67 @@ var (

// Data holds stable cri-dockerd version in semver format.
type Data struct {
Version string
FullCommit string
ShortCommit string
}

func main() {
if len(os.Args) < 3 {
log.Fatalf("Usage: update_cri_dockerd_version.go <version> <archlist>")
if len(os.Args) < 4 {
log.Fatalf("Usage: update_cri_dockerd_version.go <version> <commit> <archlist>")
}

commit := os.Args[1]
archs := os.Args[2]
version := os.Args[1]
commit := os.Args[2]
archs := os.Args[3]

data := Data{FullCommit: commit, ShortCommit: commit[:7]}
if !semver.IsValid(version) {
klog.Fatal(fmt.Errorf("invalid version %v", version))
}
version = strings.Replace(version, "v", "", 1)

data := Data{Version: version, FullCommit: commit, ShortCommit: commit[:7]}

update.Apply(schema, data)

if out, err := exec.Command("./update_cri_dockerd_version.sh", commit, archs).CombinedOutput(); err != nil {
if out, err := exec.Command("./update_cri_dockerd_version.sh", version, commit, archs).CombinedOutput(); err != nil {
log.Fatalf("failed to build and upload cri-dockerd binaries: %s", string(out))
}

fmt.Println("Don't forget you still need to update the hash files!")
if err := updateHashFiles(commit); err != nil {
log.Fatalf("failed to update hash files: %v", err)
}
}

func updateHashFiles(commit string) error {
r, err := http.Get(fmt.Sprintf("https://github.com/Mirantis/cri-dockerd/archive/%s.tar.gz", commit))
if err != nil {
return fmt.Errorf("failed to download source code: %v", err)
}
defer r.Body.Close()
b, err := io.ReadAll(r.Body)
if err != nil {
return fmt.Errorf("failed to read response body: %v", err)
}
sum := sha256.Sum256(b)
filePathBase := "../../../deploy/iso/minikube-iso/arch/"
if err := updateHashFile(filePathBase+"aarch64/package/cri-dockerd-aarch64/cri-dockerd.hash", commit, sum); err != nil {
return fmt.Errorf("aarch64: %v", err)
}
if err := updateHashFile(filePathBase+"x86_64/package/cri-dockerd/cri-dockerd.hash", commit, sum); err != nil {
return fmt.Errorf("x86_64: %v", err)
}
return nil
}

func updateHashFile(filePath, commit string, shaSum [sha256.Size]byte) error {
f, err := os.OpenFile(filePath, os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
return fmt.Errorf("failed to open hash file: %v", err)
}
defer f.Close()
if _, err := f.WriteString(fmt.Sprintf("sha256 %x %s.tar.gz\n", shaSum, commit)); err != nil {
return fmt.Errorf("failed to write to hash file: %v", err)
}
return nil
}
17 changes: 9 additions & 8 deletions hack/update/cri_dockerd_version/update_cri_dockerd_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,33 @@

set -eux -o pipefail

if [ "$#" -ne 2 ]; then
echo "Usage: update_cri_dockerd_version.sh <version> <archlist>" >&2
if [ "$#" -ne 3 ]; then
echo "Usage: update_cri_dockerd_version.sh <version> <commit> <archlist>" >&2
exit 1
fi

readonly version=$1
archlist=$2
readonly commit=$2
archlist=$3

IFS=, read -a archarray <<< "$archlist"

tmpdir=$(mktemp -d)
pushd $tmpdir
git clone -n https://github.com/Mirantis/cri-dockerd
cd cri-dockerd
git checkout $version
git checkout $commit

for (( i=0; i < ${#archarray[*]}; i++ ))
do
arch=${archarray[i]#"linux/"}
env GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build -ldflags "-X github.com/Mirantis/cri-dockerd/version.GitCommit=${version:0:7}" -o cri-dockerd-$arch
gsutil cp cri-dockerd-$arch gs://kicbase-artifacts/cri-dockerd/$version/$arch/cri-dockerd
env GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build -ldflags "-X github.com/Mirantis/cri-dockerd/version.Version=${version} -X github.com/Mirantis/cri-dockerd/version.GitCommit=${commit:0:7}" -o cri-dockerd-$arch
gsutil cp cri-dockerd-$arch gs://kicbase-artifacts/cri-dockerd/$commit/$arch/cri-dockerd

done

gsutil cp ./packaging/systemd/cri-docker.service gs://kicbase-artifacts/cri-dockerd/$version/cri-docker.service
gsutil cp ./packaging/systemd/cri-docker.socket gs://kicbase-artifacts/cri-dockerd/$version/cri-docker.socket
gsutil cp ./packaging/systemd/cri-docker.service gs://kicbase-artifacts/cri-dockerd/$commit/cri-docker.service
gsutil cp ./packaging/systemd/cri-docker.socket gs://kicbase-artifacts/cri-dockerd/$commit/cri-docker.socket

popd
rm -rf $tmpdir
4 changes: 2 additions & 2 deletions pkg/drivers/kic/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (

const (
// Version is the current version of kic
Version = "v0.0.37-1675280603-15763"
Version = "v0.0.37-1675980448-15752"

// SHA of the kic base image
baseImageSHA = "9f474b7ba8542a6ea1d4410955102c8c63c61d74579375db5b45bbc427946de8"
baseImageSHA = "bbb7d3f8805fde4c987978893d2f83e95c83b8e24ffad9b4cfa6094006b8364a"
// The name of the GCR kicbase repository
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
// The name of the Dockerhub kicbase repository
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/download/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const fileScheme = "file"
// DefaultISOURLs returns a list of ISO URL's to consult by default, in priority order
func DefaultISOURLs() []string {
v := version.GetISOVersion()
isoBucket := "minikube-builds/iso/15728"
isoBucket := "minikube-builds/iso/15752"

return []string{
fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s-%s.iso", isoBucket, v, runtime.GOARCH),
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/commands/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ minikube start [flags]
--apiserver-names strings A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine
--apiserver-port int The apiserver listening port (default 8443)
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase-builds:v0.0.37-1675280603-15763@sha256:9f474b7ba8542a6ea1d4410955102c8c63c61d74579375db5b45bbc427946de8")
--base-image string The base image to use for docker/podman drivers. Intended for local development. (default "gcr.io/k8s-minikube/kicbase-builds:v0.0.37-1675980448-15752@sha256:bbb7d3f8805fde4c987978893d2f83e95c83b8e24ffad9b4cfa6094006b8364a")
--binary-mirror string Location to fetch kubectl, kubelet, & kubeadm binaries from.
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
--cert-expiration duration Duration until minikube certificate expiration, defaults to three years (26280h). (default 26280h0m0s)
Expand Down

0 comments on commit 8d12bf3

Please sign in to comment.