diff --git a/build-tools/common.sh b/build-tools/common.sh index 4fab3236857..a5fba96be7f 100755 --- a/build-tools/common.sh +++ b/build-tools/common.sh @@ -120,6 +120,13 @@ kube::build::get_docker_wrapped_binaries() { kube-scheduler,ppc64le/busybox kube-proxy,gcr.io/google_containers/debian-iptables-ppc64le:v4 );; + "s390x") + local targets=( + kube-apiserver,s390x/busybox + kube-controller-manager,s390x/busybox + kube-scheduler,s390x/busybox + kube-proxy,gcr.io/google_containers/debian-iptables-s390x:v4 + );; esac echo "${targets[@]}" diff --git a/build-tools/debian-iptables/Makefile b/build-tools/debian-iptables/Makefile index d438557a38e..09a7e63910d 100644 --- a/build-tools/debian-iptables/Makefile +++ b/build-tools/debian-iptables/Makefile @@ -35,6 +35,10 @@ ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/debian:jessie QEMUARCH=ppc64le endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/debian:jessie + QEMUARCH=s390x +endif build: cp ./* $(TEMP_DIR) diff --git a/build-tools/debian-iptables/README.md b/build-tools/debian-iptables/README.md index 957ae4d164c..c10eaa7cba6 100644 --- a/build-tools/debian-iptables/README.md +++ b/build-tools/debian-iptables/README.md @@ -21,6 +21,9 @@ $ make push ARCH=arm64 $ make push ARCH=ppc64le # ---> gcr.io/google_containers/debian-iptables-ppc64le:TAG + +$ make push ARCH=s390x +# ---> gcr.io/google_containers/debian-iptables-s390x:TAG ``` If you don't want to push the images, run `make` or `make build` instead diff --git a/build-tools/kube-dns/Makefile b/build-tools/kube-dns/Makefile index f193690c08c..c18ec62e608 100644 --- a/build-tools/kube-dns/Makefile +++ b/build-tools/kube-dns/Makefile @@ -41,6 +41,9 @@ endif ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/busybox endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/busybox +endif all: container diff --git a/build-tools/kube-dns/RELEASES.md b/build-tools/kube-dns/RELEASES.md index 327fdbc59cc..4a62744b4cb 100644 --- a/build-tools/kube-dns/RELEASES.md +++ b/build-tools/kube-dns/RELEASES.md @@ -35,6 +35,9 @@ make container PREFIX= TAG=rc $ make push ARCH=ppc64le # ---> gcr.io/google_containers/kube-dns-ppc64le:TAG + + $ make push ARCH=s390x + # ---> gcr.io/google_containers/kube-dns-s390x:TAG ``` 6. Manually deploy this to your own cluster by updating the replication diff --git a/build-tools/pause/Makefile b/build-tools/pause/Makefile index 6cc0433c0bd..81f4174cc3b 100644 --- a/build-tools/pause/Makefile +++ b/build-tools/pause/Makefile @@ -20,10 +20,10 @@ LEGACY_AMD64_IMAGE = $(REGISTRY)/pause TAG = 3.0 -# Architectures supported: amd64, arm, arm64 and ppc64le +# Architectures supported: amd64, arm, arm64, ppc64le and s390x ARCH ?= amd64 -ALL_ARCH = amd64 arm arm64 ppc64le +ALL_ARCH = amd64 arm arm64 ppc64le s390x CFLAGS = -Os -Wall -static KUBE_CROSS_IMAGE ?= gcr.io/google_containers/kube-cross @@ -48,6 +48,10 @@ ifeq ($(ARCH),ppc64le) TRIPLE ?= powerpc64le-linux-gnu endif +ifeq ($(ARCH),s390x) + TRIPLE ?= s390x-linux-gnu +endif + # If you want to build AND push all containers, see the 'all-push' rule. all: all-container diff --git a/cluster/addons/addon-manager/Makefile b/cluster/addons/addon-manager/Makefile index 36d3bafd537..f909b06fadc 100644 --- a/cluster/addons/addon-manager/Makefile +++ b/cluster/addons/addon-manager/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/debian endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/debian +endif .PHONY: build push diff --git a/cluster/addons/addon-manager/README.md b/cluster/addons/addon-manager/README.md index bd7c96cfb37..5cbf21ec5e1 100644 --- a/cluster/addons/addon-manager/README.md +++ b/cluster/addons/addon-manager/README.md @@ -29,6 +29,9 @@ $ make push ARCH=arm64 $ make push ARCH=ppc64le # ---> gcr.io/google-containers/kube-addon-manager-ppc64le:VERSION + +$ make push ARCH=s390x +# ---> gcr.io/google-containers/kube-addon-manager-s390x:VERSION ``` If you don't want to push the images, run `make` or `make build` instead diff --git a/cluster/get-kube-binaries.sh b/cluster/get-kube-binaries.sh index 6176fbef9ca..e7d792df0c1 100755 --- a/cluster/get-kube-binaries.sh +++ b/cluster/get-kube-binaries.sh @@ -27,6 +27,7 @@ # * arm # * arm64 # * ppc64le +# * s390x # # Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt. # Set KUBERNETES_RELEASE_URL to choose where to download binaries from. @@ -86,9 +87,12 @@ function detect_client_info() { i?86*) CLIENT_ARCH="386" ;; + s390x*) + CLIENT_ARCH="s390x" + ;; *) echo "Unknown, unsupported architecture (${machine})." >&2 - echo "Supported architectures x86_64, i686, arm, arm64." >&2 + echo "Supported architectures x86_64, i686, arm, arm64, s390x." >&2 echo "Bailing out." >&2 exit 3 ;; diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile index 7859f6148a8..d8a68c787bd 100644 --- a/cluster/images/etcd/Makefile +++ b/cluster/images/etcd/Makefile @@ -46,6 +46,9 @@ endif ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/busybox endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/busybox +endif build: # Copy the content in this dir to the temp dir, diff --git a/cluster/images/etcd/README.md b/cluster/images/etcd/README.md index 3c065f3d2bb..e7dfde8bf61 100644 --- a/cluster/images/etcd/README.md +++ b/cluster/images/etcd/README.md @@ -21,6 +21,9 @@ $ make push ARCH=arm64 $ make push ARCH=ppc64le # ---> gcr.io/google_containers/etcd-ppc64le:TAG + +$ make push ARCH=s390x +# ---> gcr.io/google_containers/etcd-s390x:TAG ``` If you don't want to push the images, run `make` or `make build` instead diff --git a/cluster/images/hyperkube/Makefile b/cluster/images/hyperkube/Makefile index d612b27fa73..8570fb6eb25 100644 --- a/cluster/images/hyperkube/Makefile +++ b/cluster/images/hyperkube/Makefile @@ -45,6 +45,10 @@ ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/debian:jessie QEMUARCH=ppc64le endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/debian:jessie + QEMUARCH=s390x +endif all: build diff --git a/cluster/images/hyperkube/README.md b/cluster/images/hyperkube/README.md index 6f0db0acd77..000709a1a0f 100644 --- a/cluster/images/hyperkube/README.md +++ b/cluster/images/hyperkube/README.md @@ -25,6 +25,9 @@ $ make push VERSION={target_version} ARCH=arm64 $ make push VERSION={target_version} ARCH=ppc64le # ---> gcr.io/google_containers/hyperkube-ppc64le:VERSION + +$ make push VERSION={target_version} ARCH=s390x +# ---> gcr.io/google_containers/hyperkube-s390x:VERSION ``` If you don't want to push the images, run `make` or `make build` instead diff --git a/cluster/images/kube-discovery/Makefile b/cluster/images/kube-discovery/Makefile index 2184aa28426..5183a863684 100644 --- a/cluster/images/kube-discovery/Makefile +++ b/cluster/images/kube-discovery/Makefile @@ -37,6 +37,10 @@ endif ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/debian:jessie endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/debian:jessie +endif + all: build diff --git a/cluster/juju/layers/kubernetes/reactive/k8s.py b/cluster/juju/layers/kubernetes/reactive/k8s.py index 385e3193888..94733b82483 100644 --- a/cluster/juju/layers/kubernetes/reactive/k8s.py +++ b/cluster/juju/layers/kubernetes/reactive/k8s.py @@ -478,7 +478,7 @@ def arch(): # Convert the binary result into a string. architecture = architecture.decode('utf-8') # Validate the architecture is supported by kubernetes. - if architecture not in ['amd64', 'arm', 'arm64', 'ppc64le']: + if architecture not in ['amd64', 'arm', 'arm64', 'ppc64le', 's390x']: message = 'Unsupported machine architecture: {0}'.format(architecture) status_set('blocked', message) raise Exception(message) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 79aeb546cb4..663420c7a05 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -61,6 +61,7 @@ else linux/amd64 linux/arm linux/arm64 + linux/s390x ) if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then KUBE_SERVER_PLATFORMS+=(linux/ppc64le) @@ -78,6 +79,7 @@ else darwin/386 windows/amd64 windows/386 + linux/s390x ) if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then KUBE_CLIENT_PLATFORMS+=(linux/ppc64le) @@ -233,18 +235,32 @@ kube::golang::set_platform_envs() { # Dynamic CGO linking for other server architectures than linux/amd64 goes here # If you want to include support for more server platforms than these, add arch-specific gcc names here - if [[ ${platform} == "linux/arm" ]]; then - export CGO_ENABLED=1 - export CC=arm-linux-gnueabi-gcc - # See https://github.com/kubernetes/kubernetes/issues/29904 - export GOROOT=${K8S_PATCHED_GOROOT} - elif [[ ${platform} == "linux/arm64" ]]; then - export CGO_ENABLED=1 - export CC=aarch64-linux-gnu-gcc - elif [[ ${platform} == "linux/ppc64le" ]]; then - export CGO_ENABLED=1 - export CC=powerpc64le-linux-gnu-gcc - fi + case "${platform}" in + "linux/amd64") + ;; + "linux/arm") + export CGO_ENABLED=1 + export CC=arm-linux-gnueabi-gcc + # See https://github.com/kubernetes/kubernetes/issues/29904 + export GOROOT=${K8S_PATCHED_GOROOT} + ;; + "linux/arm64") + export CGO_ENABLED=1 + export CC=aarch64-linux-gnu-gcc + ;; + "linux/ppc64le") + export CGO_ENABLED=1 + export CC=powerpc64le-linux-gnu-gcc + ;; + "linux/s390x") + export CGO_ENABLED=1 + export CC=s390x-linux-gnu-gcc + ;; + *) + echo "Unsupported architecture to cross-compile from linux/amd64." >&2 + exit 1 + ;; + esac fi } diff --git a/test/images/serve_hostname/Makefile b/test/images/serve_hostname/Makefile index fcc8d5db398..3b30203e533 100644 --- a/test/images/serve_hostname/Makefile +++ b/test/images/serve_hostname/Makefile @@ -24,10 +24,10 @@ TAG ?= v1.5 REGISTRY ?= gcr.io/google_containers TEST_REGISTRY ?= b.gcr.io/k8s_authenticated_test -# Architectures supported: amd64, arm, arm64 and ppc64le +# Architectures supported: amd64, arm, arm64, ppc64le and s390x ARCH ?= amd64 -ALL_ARCH = amd64 arm arm64 ppc64le +ALL_ARCH = amd64 arm arm64 ppc64le s390x GOARM=6 TEMP_DIR := $(shell mktemp -d) @@ -52,6 +52,9 @@ endif ifeq ($(ARCH),ppc64le) BASEIMAGE?=ppc64le/busybox endif +ifeq ($(ARCH),s390x) + BASEIMAGE?=s390x/busybox +endif # If you want to build AND push all containers, see the 'all-push' rule. all: all-container diff --git a/test/images/serve_hostname/README.md b/test/images/serve_hostname/README.md index 3efc0e8874e..28d37336642 100644 --- a/test/images/serve_hostname/README.md +++ b/test/images/serve_hostname/README.md @@ -25,6 +25,9 @@ $ make push ARCH=arm64 $ make push ARCH=ppc64le # ---> gcr.io/google_containers/serve_hostname-ppc64le:TAG + +$ make push ARCH=s390x +# ---> gcr.io/google_containers/serve_hostname-s390x:TAG ``` Of course, if you don't want to push the images, run `make all-container` or `make container ARCH={target_arch}` instead.