Skip to content

Commit

Permalink
adding multi-arch support
Browse files Browse the repository at this point in the history
  • Loading branch information
salamani committed Apr 17, 2019
1 parent 2f1929f commit 9b419d6
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 65 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ _testmain.go
/out
/_gopath


#.yaml files specific to deploy's .template extensions
deploy/addons/addon-manager.yaml
deploy/addons/dashboard/dashboard-dp.yaml
deploy/addons/heapster/heapster-rc.yaml
deploy/addons/heapster/influx-grafana-rc.yaml
deploy/addons/ingress/ingress-dp.yaml
deploy/addons/metrics-server/metrics-server-deployment.yaml
deploy/addons/storage-provisioner/storage-provisioner.yaml

#iso version file
deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/etc/VERSION

Expand All @@ -38,4 +48,4 @@ deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/etc/VERSION

/.idea

/.vscode
/.vscode
47 changes: 38 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ endif
ifeq ($(GOOS),windows)
IS_EXE = ".exe"
endif

ifeq ($(GOARCH),amd64)
ARCHTAG ?= -amd64
ARCHTAG_NONE ?=
else
ARCHTAG ?= -$(GOARCH)
ARCHTAG_NONE ?= -$(GOARCH)
endif

.PHONY: makedeploys
makedeploys:
sed "s|\-ARCHTAG_NONE|$(ARCHTAG_NONE)|g" deploy/addons/addon-manager.template > deploy/addons/addon-manager.yaml
sed "s|\-ARCHTAG|$(ARCHTAG)|g" deploy/addons/dashboard/dashboard-dp.template > deploy/addons/dashboard/dashboard-dp.yaml
sed "s|\-ARCHTAG|$(ARCHTAG)|g" deploy/addons/heapster/heapster-rc.template > deploy/addons/heapster/heapster-rc.yaml
sed "s|\-ARCHTAG|$(ARCHTAG)|g" deploy/addons/heapster/influx-grafana-rc.template > deploy/addons/heapster/influx-grafana-rc.yaml
sed "s|\-ARCHTAG_NONE|$(ARCHTAG_NONE)|g" deploy/addons/ingress/ingress-dp.template > deploy/addons/ingress/ingress-dp.yaml
sed "s|\-ARCHTAG|$(ARCHTAG)|g" deploy/addons/metrics-server/metrics-server-deployment.template > deploy/addons/metrics-server/metrics-server-deployment.yaml
sed "s|\-ARCHTAG_NONE|$(ARCHTAG_NONE)|g" deploy/addons/storage-provisioner/storage-provisioner.template > deploy/addons/storage-provisioner/storage-provisioner.yaml

out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE)
cp $< $@

Expand All @@ -109,7 +128,9 @@ out/minikube.d: pkg/minikube/assets/assets.go
$(MAKEDEPEND) out/minikube-$(GOOS)-$(GOARCH) $(ORG) $^ $(MINIKUBEFILES) > $@

-include out/minikube.d
out/minikube-%: pkg/minikube/assets/assets.go

PHONY: out/minikube-%
out/minikube-%:makedeploys pkg/minikube/assets/assets.go
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
else
Expand All @@ -127,9 +148,9 @@ endif
GOOS="$(firstword $(subst -, ,$*))" GOARCH="$(lastword $(subst -, ,$*))" go build -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" -a -o $@ k8s.io/minikube/cmd/minikube
endif

.PHONY: e2e-%-amd64
e2e-%-amd64: out/minikube-%-amd64
GOOS=$* GOARCH=amd64 go test -c k8s.io/minikube/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" -o out/$@
.PHONY: e2e-%-$(GOARCH)
e2e-%-$(GOARCH): out/minikube-%-$(GOARCH)
GOOS=$* GOARCH=$(GOARCH) go test -c k8s.io/minikube/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" -o out/$@

e2e-windows-amd64.exe: e2e-windows-amd64
mv $(BUILD_DIR)/e2e-windows-amd64 $(BUILD_DIR)/e2e-windows-amd64.exe
Expand Down Expand Up @@ -192,8 +213,8 @@ integration: out/minikube
go test -v -test.timeout=60m $(REPOPATH)/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" $(TEST_ARGS)

.PHONY: integration-none-driver
integration-none-driver: e2e-linux-amd64 out/minikube-linux-amd64
sudo -E out/e2e-linux-amd64 -testdata-dir "test/integration/testdata" -minikube-start-args="--vm-driver=none" -test.v -test.timeout=60m -binary=out/minikube-linux-amd64 $(TEST_ARGS)
integration-none-driver: e2e-linux-$(GOARCH) out/minikube-linux-$(GOARCH)
sudo -E out/e2e-linux-$(GOARCH) -testdata-dir "test/integration/testdata" -minikube-start-args="--vm-driver=none" -test.v -test.timeout=60m -binary=out/minikube-linux-amd64 $(TEST_ARGS)

.PHONY: integration-versioned
integration-versioned: out/minikube
Expand All @@ -212,14 +233,14 @@ pkg/minikube/assets/assets.go: $(shell find deploy/addons -type f)
PATH="$(PATH):$(GOPATH)/bin" go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...

.PHONY: cross
cross: out/minikube-linux-amd64 out/minikube-darwin-amd64 out/minikube-windows-amd64.exe
cross: out/minikube-linux-$(GOARCH) out/minikube-darwin-amd64 out/minikube-windows-amd64.exe

.PHONY: e2e-cross
e2e-cross: e2e-linux-amd64 e2e-darwin-amd64 e2e-windows-amd64.exe

.PHONY: checksum
checksum:
for f in out/minikube-linux-amd64 out/minikube-darwin-amd64 out/minikube-windows-amd64.exe out/minikube.iso \
for f in out/minikube-linux-$(GOARCH) out/minikube-darwin-amd64 out/minikube-windows-amd64.exe out/minikube.iso \
out/docker-machine-driver-kvm2 out/docker-machine-driver-hyperkit; do \
if [ -f "$${f}" ]; then \
openssl sha256 "$${f}" | awk '{print $$2}' > "$${f}.sha256" ; \
Expand Down Expand Up @@ -337,11 +358,19 @@ out/storage-provisioner:

.PHONY: storage-provisioner-image
storage-provisioner-image: out/storage-provisioner
docker build -t $(REGISTRY)/storage-provisioner:$(STORAGE_PROVISIONER_TAG) -f deploy/storage-provisioner/Dockerfile .
ifeq ($(GOARCH),amd64)
docker build -t $(REGISTRY)/storage-provisioner:$(STORAGE_PROVISIONER_TAG) -f deploy/storage-provisioner/Dockerfile .
else
docker build -t $(REGISTRY)/storage-provisioner-$(GOARCH):$(STORAGE_PROVISIONER_TAG) -f deploy/storage-provisioner/Dockerfile-$(GOARCH) .
endif

.PHONY: push-storage-provisioner-image
push-storage-provisioner-image: storage-provisioner-image
ifeq ($(GOARCH),amd64)
gcloud docker -- push $(REGISTRY)/storage-provisioner:$(STORAGE_PROVISIONER_TAG)
else
gcloud docker -- push $(REGISTRY)/storage-provisioner-$(GOARCH):$(STORAGE_PROVISIONER_TAG)
endif

.PHONY: out/gvisor-addon
out/gvisor-addon:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: {{default "k8s.gcr.io" .ImageRepository}}/kube-addon-manager:v9.0
image: {{default "k8s.gcr.io" .ImageRepository}}/kube-addon-manager-ARCHTAG_NONE:v9.0
env:
- name: KUBECONFIG
value: /var/lib/minikube/kubeconfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
spec:
containers:
- name: kubernetes-dashboard
image: {{default "k8s.gcr.io" .ImageRepository}}/kubernetes-dashboard-amd64:v1.10.1
image: {{default "k8s.gcr.io" .ImageRepository}}/kubernetes-dashboard-ARCHTAG:v1.10.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9090
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
spec:
containers:
- name: heapster
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-amd64:v1.5.3
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-ARCHTAG:v1.5.3
imagePullPolicy: IfNotPresent
command:
- /heapster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
spec:
containers:
- name: influxdb
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-influxdb-amd64:v1.3.3
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-influxdb-ARCHTAG:v1.3.3
imagePullPolicy: IfNotPresent
ports:
- name: http
Expand All @@ -45,7 +45,7 @@ spec:
- mountPath: /data
name: influxdb-storage
- name: grafana
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-grafana-amd64:v4.4.3
image: {{default "k8s.gcr.io" .ImageRepository}}/heapster-grafana-ARCHTAG:v4.4.3
imagePullPolicy: IfNotPresent
env:
- name: INFLUXDB_SERVICE_URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: {{default "gcr.io/google_containers" .ImageRepository}}/defaultbackend:1.4
image: {{default "gcr.io/google_containers" .ImageRepository}}/defaultbackend-ARCHTAG_NONE:1.4
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
Expand Down Expand Up @@ -87,7 +87,7 @@ spec:
serviceAccountName: nginx-ingress
terminationGracePeriodSeconds: 60
containers:
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.23.0
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller-ARCHTAG_NONE:0.23.0
name: nginx-ingress-controller
imagePullPolicy: IfNotPresent
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
spec:
containers:
- name: metrics-server
image: {{default "k8s.gcr.io" .ImageRepository}}/metrics-server-amd64:v0.2.1
image: {{default "k8s.gcr.io" .ImageRepository}}/metrics-server-ARCHTAG:v0.2.1
imagePullPolicy: Always
command:
- /metrics-server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
hostNetwork: true
containers:
- name: storage-provisioner
image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner:v1.8.1
image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner-ARCHTAG_NONE:v1.8.1
command: ["/storage-provisioner"]
imagePullPolicy: IfNotPresent
volumeMounts:
Expand Down
17 changes: 17 additions & 0 deletions deploy/storage-provisioner/Dockerfile-s390x
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM s390x/ubuntu:16.04
COPY out/storage-provisioner storage-provisioner
CMD ["/storage-provisioner"]
101 changes: 55 additions & 46 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func GetMinipath() string {
return filepath.Join(os.Getenv(MinikubeHome), ".minikube")
}

// ArchTag returns the archtag for images
func ArchTag(hasTag bool) string {
if runtime.GOARCH == "amd64" && hasTag == false {
return ":"
} else {
return "-" + runtime.GOARCH + ":"
}
}

// SupportedVMDrivers is a list of supported drivers on all platforms. Currently
// used in gendocs.
var SupportedVMDrivers = [...]string{
Expand Down Expand Up @@ -266,17 +275,17 @@ func GetKubeadmCachedImages(imageRepository string, kubernetesVersionStr string)
var images []string
if v1_12plus(kubernetesVersion) {
images = append(images, []string{
imageRepository + "kube-proxy:" + kubernetesVersionStr,
imageRepository + "kube-scheduler:" + kubernetesVersionStr,
imageRepository + "kube-controller-manager:" + kubernetesVersionStr,
imageRepository + "kube-apiserver:" + kubernetesVersionStr,
imageRepository + "kube-proxy" + ArchTag(false) + kubernetesVersionStr,
imageRepository + "kube-scheduler" + ArchTag(false) + kubernetesVersionStr,
imageRepository + "kube-controller-manager" + ArchTag(false) + kubernetesVersionStr,
imageRepository + "kube-apiserver" + ArchTag(false) + kubernetesVersionStr,
}...)
} else {
images = append(images, []string{
imageRepository + "kube-proxy-amd64:" + kubernetesVersionStr,
imageRepository + "kube-scheduler-amd64:" + kubernetesVersionStr,
imageRepository + "kube-controller-manager-amd64:" + kubernetesVersionStr,
imageRepository + "kube-apiserver-amd64:" + kubernetesVersionStr,
imageRepository + "kube-proxy" + ArchTag(true) + kubernetesVersionStr,
imageRepository + "kube-scheduler" + ArchTag(true) + kubernetesVersionStr,
imageRepository + "kube-controller-manager" + ArchTag(true) + kubernetesVersionStr,
imageRepository + "kube-apiserver" + ArchTag(true) + kubernetesVersionStr,
}...)
}

Expand All @@ -285,84 +294,84 @@ func GetKubeadmCachedImages(imageRepository string, kubernetesVersionStr string)
podInfraContainerImage = imageRepository + "pause:3.1"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.13",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.13",
imageRepository + "k8s-dns-sidecar-amd64:1.14.13",
imageRepository + "etcd:3.3.10",
imageRepository + "coredns:1.3.1",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.13",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.13",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.13",
imageRepository + "etcd" + ArchTag(false) + "3.3.10",
imageRepository + "coredns" + ArchTag(false) + "1.3.1",
}...)

} else if v1_13(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.1"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.1"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.8",
imageRepository + "k8s-dns-sidecar-amd64:1.14.8",
imageRepository + "etcd:3.2.24",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.8",
imageRepository + "etcd" + ArchTag(false) + "3.2.24",
imageRepository + "coredns:1.2.6",
}...)

} else if v1_12(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.1"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.8",
imageRepository + "k8s-dns-sidecar-amd64:1.14.8",
imageRepository + "etcd:3.2.24",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.8",
imageRepository + "etcd" + ArchTag(false) + "3.2.24",
imageRepository + "coredns:1.2.2",
}...)

} else if v1_11(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.1"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.1"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.8",
imageRepository + "k8s-dns-sidecar-amd64:1.14.8",
imageRepository + "etcd-amd64:3.2.18",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.8",
imageRepository + "etcd" + ArchTag(true) + "3.2.18",
imageRepository + "coredns:1.1.3",
}...)

} else if v1_10(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.1"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.1"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.8",
imageRepository + "k8s-dns-sidecar-amd64:1.14.8",
imageRepository + "etcd-amd64:3.1.12",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.8",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.8",
imageRepository + "etcd" + ArchTag(true) + "3.1.12",
}...)

} else if v1_9(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.0"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.0"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.7",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.7",
imageRepository + "k8s-dns-sidecar-amd64:1.14.7",
imageRepository + "etcd-amd64:3.1.10",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.7",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.7",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.7",
imageRepository + "etcd" + ArchTag(true) + "3.1.10",
}...)

} else if v1_8(kubernetesVersion) {
podInfraContainerImage = imageRepository + "pause:3.0"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.0"
images = append(images, []string{
podInfraContainerImage,
imageRepository + "k8s-dns-kube-dns-amd64:1.14.5",
imageRepository + "k8s-dns-dnsmasq-nanny-amd64:1.14.5",
imageRepository + "k8s-dns-sidecar-amd64:1.14.5",
imageRepository + "etcd-amd64:3.0.17",
imageRepository + "k8s-dns-kube-dns" + ArchTag(true) + "1.14.5",
imageRepository + "k8s-dns-dnsmasq-nanny" + ArchTag(true) + "1.14.5",
imageRepository + "k8s-dns-sidecar" + ArchTag(true) + "1.14.5",
imageRepository + "etcd" + ArchTag(true) + "3.0.17",
}...)

} else {
podInfraContainerImage = imageRepository + "pause:3.0"
podInfraContainerImage = imageRepository + "pause" + ArchTag(false) + "3.0"
}

images = append(images, []string{
imageRepository + "kubernetes-dashboard-amd64:v1.10.1",
imageRepository + "kube-addon-manager:v9.0",
minikubeRepository + "storage-provisioner:v1.8.1",
imageRepository + "kubernetes-dashboard" + ArchTag(true) + "v1.10.1",
imageRepository + "kube-addon-manager" + ArchTag(false) + "v9.0",
minikubeRepository + "storage-provisioner" + ArchTag(false) + "v1.8.1",
}...)

return podInfraContainerImage, images
Expand Down

0 comments on commit 9b419d6

Please sign in to comment.