Skip to content

Commit 5de7650

Browse files
Merge pull request #13124 from sharifelgamal/kicbase-arch
fix kicbase dockerfile to allow ppc64le and armv7 archs
2 parents 1c1aa81 + a6ef730 commit 5de7650

File tree

6 files changed

+51
-18
lines changed

6 files changed

+51
-18
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ docker-multi-arch-builder:
690690
env $(X_BUILD_ENV) docker buildx rm --builder $(X_DOCKER_BUILDER) || true
691691
env $(X_BUILD_ENV) docker buildx create --name $(X_DOCKER_BUILDER) --buildkitd-flags '--debug' || true
692692

693-
KICBASE_ARCH = linux/amd64,linux/arm64,linux/s390x
693+
KICBASE_ARCH ?= linux/amd64,linux/arm64,linux/s390x,linux/arm,linux/ppc64le
694694
KICBASE_IMAGE_GCR ?= $(REGISTRY)/kicbase:$(KIC_VERSION)
695695
KICBASE_IMAGE_HUB ?= kicbase/stable:$(KIC_VERSION)
696696
KICBASE_IMAGE_REGISTRIES ?= $(KICBASE_IMAGE_GCR) $(KICBASE_IMAGE_HUB)

cmd/minikube/cmd/start.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -1280,25 +1280,30 @@ func validateDiskSize(diskSize string) error {
12801280
}
12811281

12821282
// validateRuntime validates the supplied runtime
1283-
func validateRuntime(runtime string) error {
1283+
func validateRuntime(rtime string) error {
12841284
validOptions := cruntime.ValidRuntimes()
12851285
// `crio` is accepted as an alternative spelling to `cri-o`
12861286
validOptions = append(validOptions, constants.CRIO)
12871287

12881288
var validRuntime bool
12891289
for _, option := range validOptions {
1290-
if runtime == option {
1290+
if rtime == option {
12911291
validRuntime = true
12921292
}
12931293

12941294
// Convert `cri-o` to `crio` as the K8s config uses the `crio` spelling
1295-
if runtime == "cri-o" {
1295+
if rtime == "cri-o" {
12961296
viper.Set(containerRuntime, constants.CRIO)
12971297
}
1298+
1299+
}
1300+
1301+
if (rtime == "crio" || rtime == "cri-o") && (strings.HasPrefix(runtime.GOARCH, "ppc64") || detect.RuntimeArch() == "arm" || strings.HasPrefix(detect.RuntimeArch(), "arm/")) {
1302+
return errors.Errorf("The %s runtime is not compatible with the %s architecture. See https://github.com/cri-o/cri-o/issues/2467 for more details.", rtime, runtime.GOARCH)
12981303
}
12991304

13001305
if !validRuntime {
1301-
return errors.Errorf("Invalid Container Runtime: %s. Valid runtimes are: %s", runtime, cruntime.ValidRuntimes())
1306+
return errors.Errorf("Invalid Container Runtime: %s. Valid runtimes are: %s", rtime, cruntime.ValidRuntimes())
13021307
}
13031308
return nil
13041309
}

deploy/kicbase/Dockerfile

+25-10
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ RUN clean-install \
121121
fuse3
122122

123123
# install docker
124-
RUN sh -c "echo 'deb https://download.docker.com/linux/ubuntu focal stable' > /etc/apt/sources.list.d/docker.list" && \
124+
# use the bionic packages for arm32
125+
RUN export ARCH=$(dpkg --print-architecture | sed 's/armhf/arm-v7/') && \
126+
if [ "$ARCH" == "arm-v7" ]; then export DIST="bionic"; else export DIST="focal"; fi && \
127+
sh -c "echo 'deb https://download.docker.com/linux/ubuntu ${DIST} stable' > /etc/apt/sources.list.d/docker.list" && \
125128
curl -L https://download.docker.com/linux/ubuntu/gpg -o docker.key && \
126129
apt-key add - < docker.key && \
127130
clean-install docker-ce docker-ce-cli containerd.io
@@ -159,19 +162,26 @@ RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/
159162
&& systemctl enable buildkit.socket
160163

161164
# Install cri-o/podman dependencies:
162-
RUN sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
165+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/') && \
166+
sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
163167
curl -LO https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_20.04/Release.key && \
164168
apt-key add - < Release.key && \
165-
clean-install containers-common catatonit conmon containernetworking-plugins cri-tools podman-plugins crun
169+
if [ "$ARCH" != "ppc64le" ]; then \
170+
clean-install containers-common catatonit conmon containernetworking-plugins cri-tools podman-plugins crun; \
171+
else \
172+
clean-install containers-common conmon containernetworking-plugins crun; \
173+
fi
166174

167175
# install cri-o based on https://github.com/cri-o/cri-o/blob/release-1.22/README.md#installing-cri-o
168-
RUN sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${CRIO_VERSION}/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:${CRIO_VERSION}.list" && \
176+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/armhf/arm-v7/') && \
177+
if [ "$ARCH" != "ppc64le" ] && [ "$ARCH" != "arm-v7" ]; then sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${CRIO_VERSION}/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:${CRIO_VERSION}.list" && \
169178
curl -LO https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${CRIO_VERSION}/xUbuntu_20.04/Release.key && \
170179
apt-key add - < Release.key && \
171-
clean-install cri-o cri-o-runc
180+
clean-install cri-o cri-o-runc; fi
172181

173182
# install podman
174-
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
183+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/') && \
184+
if [ "$ARCH" != "ppc64le" ]; then sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
175185
curl -LO https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_20.04/Release.key && \
176186
apt-key add - < Release.key && \
177187
clean-install podman && \
@@ -181,7 +191,7 @@ RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/lib
181191
> /etc/systemd/system/podman.socket.d/override.conf && \
182192
mkdir -p /etc/tmpfiles.d && \
183193
echo "d /run/podman 0770 root podman" > /etc/tmpfiles.d/podman.conf && \
184-
systemd-tmpfiles --create
194+
systemd-tmpfiles --create; fi
185195

186196
# automount service
187197
COPY deploy/kicbase/automount/minikube-automount /usr/sbin/minikube-automount
@@ -195,9 +205,14 @@ COPY deploy/kicbase/scheduled-stop/minikube-scheduled-stop.service /usr/lib/syst
195205
RUN chmod +x /var/lib/minikube/scheduled-stop/minikube-scheduled-stop
196206

197207
# disable non-docker runtimes by default
198-
RUN systemctl disable containerd && systemctl disable crio && rm /etc/crictl.yaml
208+
RUN systemctl disable containerd
209+
# disable crio for archs that support it
210+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/armhf/arm-v7/') && \
211+
if [ "$ARCH" != "ppc64le" ] && [ "$ARCH" != "arm-v7" ]; then systemctl disable crio && rm /etc/crictl.yaml; fi
212+
# enable podman socket on archs that support it
213+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/') && if [ "$ARCH" != "ppc64le" ]; then systemctl enable podman.socket; fi
199214
# enable docker which is default
200-
RUN systemctl enable docker.service && systemctl enable podman.socket
215+
RUN systemctl enable docker.service
201216
# making SSH work for docker container
202217
# based on https://github.com/rastasheep/ubuntu-sshd/blob/master/18.04/Dockerfile
203218
RUN mkdir /var/run/sshd
@@ -216,7 +231,7 @@ EXPOSE 22
216231
# create docker user for minikube ssh. to match VM using "docker" as username
217232
RUN adduser --ingroup docker --disabled-password --gecos '' docker
218233
RUN adduser docker sudo
219-
RUN adduser docker podman
234+
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/') && if [ "$ARCH" != "ppc64le" ]; then adduser docker podman; fi
220235
RUN adduser docker buildkit
221236
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
222237
USER docker

pkg/drivers/kic/types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424

2525
const (
2626
// Version is the current version of kic
27-
Version = "v0.0.28-1638824847-13104"
27+
Version = "v0.0.28-1639515145-13124"
2828
// SHA of the kic base image
29-
baseImageSHA = "a90edc66cae8cca35685dce007b915405a2ba91d903f99f7d8f79cd9d1faabab"
29+
baseImageSHA = "50a7fba584fcd78435535ec8407fa75d58db1612175b13fd473300d522f7ac80"
3030
// The name of the GCR kicbase repository
3131
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
3232
// The name of the Dockerhub kicbase repository

pkg/minikube/driver/driver_darwin.go

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package driver
1919
import (
2020
"os/exec"
2121
"runtime"
22+
"strings"
2223
)
2324

2425
// supportedDrivers is a list of supported drivers on Darwin.
@@ -31,6 +32,18 @@ var supportedDrivers = func() []string {
3132
SSH,
3233
}
3334
}
35+
// PowerPC does not support podman
36+
if strings.HasPrefix(runtime.GOARCH, "ppc") {
37+
return []string{
38+
VirtualBox,
39+
Parallels,
40+
VMwareFusion,
41+
HyperKit,
42+
VMware,
43+
Docker,
44+
SSH,
45+
}
46+
}
3447
return []string{
3548
VirtualBox,
3649
Parallels,

site/content/en/docs/commands/start.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ minikube start [flags]
2626
--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
2727
--apiserver-port int The apiserver listening port (default 8443)
2828
--auto-update-drivers If set, automatically updates drivers to the latest version. Defaults to true. (default true)
29-
--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.28-1638824847-13104@sha256:a90edc66cae8cca35685dce007b915405a2ba91d903f99f7d8f79cd9d1faabab")
29+
--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.28-1639515145-13124@sha256:50a7fba584fcd78435535ec8407fa75d58db1612175b13fd473300d522f7ac80")
3030
--cache-images If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none. (default true)
3131
--cert-expiration duration Duration until minikube certificate expiration, defaults to three years (26280h). (default 26280h0m0s)
3232
--cni string CNI plug-in to use. Valid options: auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest (default: auto)

0 commit comments

Comments
 (0)